menu
Channels
Team

passing props with redirect component

December 18, 2018 at 2:12am

passing props with redirect component

December 18, 2018 at 2:12am (Edited 9 months ago)

hello. is there any documentation about passing a props to Redirect component like this in react-router?

<Redirect to={{
pathname: '/order',
state: { id: '123' }
}}
/>

if none is there a way? like a "hack" if not. I was thinking, since we're using redux so for every link ill put a action that pass the path so i can grab it from the store.


January 24, 2019 at 2:29pm

why not make this a URL query parameter? RR's state was hacky. The state of your application should be repeatable if the app gets refreshed in the browser. Managing that in redux won't work for an app refresh. Query params solve your problem. /order?stateId=123

  • reply
  • like

January 31, 2019 at 12:26am

hey josh. sorry wasnt active on spectrum. thank for your suggestion. we implemented that actually. thank you

  • reply
  • like

Not sure if you did it before or after seeing my post, but I’m going to assume after so it makes me feel like I solved your problem. ☺️

like-fill
1
  • reply
  • like