2

This answer doesn't quite cover it since it appears that you have to pass a reconstructed URL into pathname

If I am on the child page of these routes:

  <Route name="Parent" path="/parent/:parentId" component={Parent}>
    <Route name="Child" path="/child/:childId" component={Child}>

how do I programmatically update the :parentId without having to re-construct the entire URL?

Something along the lines of history.push({ ...., params: {parentId: 'newParent'}}) would be ideal.

Thanks!

Community
  • 1
  • 1
JD.
  • 2,361
  • 6
  • 25
  • 38
  • asked same question here: http://stackoverflow.com/questions/43130682/change-react-router-route-params-programatically – Idan Gozlan Mar 31 '17 at 00:55
  • Possible duplicate of [How do you programmatically update query params in react-router?](https://stackoverflow.com/questions/40161516/how-do-you-programmatically-update-query-params-in-react-router) – Neil Sep 22 '17 at 06:36

0 Answers0