Reputation: 561
Can someone help me with following issue:
<Route path="/" component={ App } >
<Route path="posts/(:id)" component={ PostsIndex } />
<Route path="admin" component={ Admin } />
</Route>
When I add dynamic routing (:id), I get an error: [react-router] Location "/posts" did not match any routes.
I delete the (:id) and everything just works fine.
Your help is much appreciated
Upvotes: 1
Views: 1521
Reputation: 322
<Route path="/" component={ App } >
<Route path="posts" component={ PostsIndex }>
<Route path="posts/:id" component={ PostsIndex } />
</Route>
<Route path="admin" component={ Admin } />
</Route>
Nested routes should help in this case.
Upvotes: 2