Hello I couldn't find any documentation about passing props with redirect like this is react-router
<Redirect to={{
pathname: '/order',
state: { id: '123' }
}}
/>
Typically, with Redirect, you can think of it as popping a view of the stack, in which there would be no state to pass. If wanting to redirect but bring state, then navigate would probably suit you better.
Good insight though, in that the docs should point out these differences 馃
whoops, reopening so the docs can reflect the convo.
Thank you for this. This will be helpful. Appreciate the response. :)
Seems like it's possible to do this :
<Redirect to="/order" state={{ id: '123' }}
/>
Under the hood, the state is passed to navigate.
https://github.com/reach/router/blob/28a79e7fc3a3487cb3304210dc3501efb8a50eba/src/index.js#L465
the state can then be fetched in location.state.
Is it an intended feature ?
Most helpful comment
Seems like it's possible to do this :
<Redirect to="/order" state={{ id: '123' }} />Under the hood, the state is passed to navigate.
https://github.com/reach/router/blob/28a79e7fc3a3487cb3304210dc3501efb8a50eba/src/index.js#L465
the state can then be fetched in
location.state.Is it an intended feature ?