I'm working with react js and I'm looking for a solution to send data via Link. When I click on a menu it redirect me to another page and I want to get a data from previous page so this is what I did:
<Menu>
<Menu.Item>
<Link to="/servicecontreservice" params={{ dataToSend: '55' }} >Proposer un service</Link>
</Menu.Item>
<Menu.Item>
<Link to="/prix">Proposer un montant</Link>
</Menu.Item>
</Menu>
and in the an anther file there is this code to get data from Link:
class myClass extends React.Component {
state = {
value:`${this.props.dataToSend}`}
render() {
return(
<p> {this.state.value}</p>
);
}
}
myClass.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles()(myClass);
...but I get no data, when I use console.log(${this.props.eventName}
) I got "undifined".