I have a button on click of which i am navigating to the other component
<Link to="/result"><button onClick = {this.setDealSizeAndType} name="patient">Calculate</button></Link>
  setDealSizeAndType({ target }){
    const dealTypeName = target.name ;
    this.setState({
      dealType: dealTypeName
    }, function(){
        this.props.setDealType(this.state.dealType);
    });
  }
function mapDispatchToProps(dispatch){
  return {
    setDealType: (dealType) =>{
      dispatch(setType(dealType));
    }
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(Calculator);
But the state is not getting set. I am getting undefined. I have to get this value in my next component which is not related to this component. Is there any way , i can set the state , before rendering of next component.
 
     
    