在react-router-v4中,您不嵌套<Routes />
。相反,您将它们放在另一个中<Component />
。
例如
<Route path='/topics' component={Topics}> <Route path='/topics/:topicId' component={Topic} /></Route>应该成为
<Route path='/topics' component={Topics} />与
const Topics = ({ match }) => ( <div> <h2>Topics</h2> <link to={`${match.url}/exampleTopicId`}> Example topic </link> <Route path={`${match.path}/:topicId`} component={Topic}/> </div>)


