I want to display state from link, like this :
<Link to={{ pathname: '/courses/product/productlist', state: { fromDashboard: true }}}> Food & Treats </Link>
How can I display state in component ?
I want to display state from link, like this :
<Link to={{ pathname: '/courses/product/productlist', state: { fromDashboard: true }}}> Food & Treats </Link>
How can I display state in component ?
State will be available in location
props inside component.
Access the state like this:
render(){
console.log('state', this.props.location.state.fromDashboard);
return (....)
}
Check the Doc for more details.