是否可以使用反应路由器执行此操作?
<Route path="/:reset_password" component={ResetPassword} />
<Route path="/:create_password" component={CreatePassword}/>
我想使用不同的param与不同的组件。我测试上面的代码,但它不起作用。如果我改为这个,上面的代码可以工作:
<Route path="/something1/:reset_password" component={ResetPassword} />
<Route path="/something2/:create_password" component={CreatePassword}/>
感谢您的帮助
答案 0 :(得分:0)
正如@chris所说,删除冒号和/或分配专用路线。 React Router无法区分您提供的两条路由,因为它们在技术上是相同的(根路径+动态参数)。