how to get state value from history react

JavaScript
history.push({
  pathname: '/path',
  customNameData: yourData,
});this.props.location.customNameData // it is equal to yourDatahistory.push('/path', yourData);
Source

Also in JavaScript: