我试图在react-router中实现以下路由:
<Route name='user' path='/:userId' handler={Profile}>
<DefaultRoute handler={Welcome}/>
<Route name='message' path='/:messageId' handler={Timeline} />
</Route>
我在控制台中收到以下错误
Uncaught Error: Invariant Violation: You cannot nest path "/:userId" inside "/:messageId"; the parent requires URL parameters
有没有办法在react-router中嵌套多个带参数的路由?
答案 0 :(得分:1)
可以设置path =“/ user /:userId”?检查https://github.com/rackt/react-router