I'm using react-router-dom Link to direct the user to another endpoint. I'd like to be able to send params, such as the current components props or local state.
I've tried this...
<Link to='/meals/new' params='test'>Add Food</Link>
The props show up empty... screen shot of props
I've had minor success when I tried to pass extra params like this..
const newTo = {
pathname: '/meals/new',
params: 'Test',
title: this.state.title
}
Using that style, I include it with the Link like this..
<Link to={newTo}</Link>
In that particular case, I get the object within my Location key. However, I'm defining the const outside of my class, and don't know how to grab local state if I do it this way.
Is there a way to get my first method working?
Thanks!