Reach / API Discussion

passing props with redirect component

passing props with redirect component

Reach / API Discussion · December 18, 2018 at 2:12am (Edited 2 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

@josh-hardy 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. ☺️

  • reply
  • like

Log in or sign up to chat