I try to understand the nested routing in react using react-router-dom. I was simply following their offical docs. Where The route /users loads the Users component, which renders any further <Route>'s conditionally on the paths :id value. Here is the codesandbox link. But whenever I goto users/:id, it render the fallback component. I was wondering where I do wrong?
Add a comment
|
1 Answer
You need to remove the exact value here:
<Route exact path="/users" component={Users} />
if you use exact only that EXACT path will be usable so /users is fine but /users/1 is not
2 Comments
falamiw
Thanks @istvan Kolkert I feel shame seriously I failed to catch this. I will accept your answer after 7 min.
istvan kolkert
@falamiw Haha no worries, everyone overlooks things no shame in asking