这个答案 https://stackoverflow.com/questions/38678804/in-react-router-how-do-you-pass-route-parameters-when-using-browser-history-pus并没有完全涵盖它,因为看起来您必须将重构的 URL 传递到pathname
如果我在这些路线的子页面上:
<Route name="Parent" path="/parent/:parentId" component={Parent}>
<Route name="Child" path="/child/:childId" component={Child}>
我如何以编程方式更新:parentId
无需重新构造整个 URL?
类似的东西history.push({ ...., params: {parentId: 'newParent'}})
将是理想的。
Thanks!
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)