Closed CodingReaction closed 10 months ago
Hey, @CodingReaction. I don't think Router
inside Switch
is supported. Consider using the latest version where nested routing comes out-of-the-box.
Oh, and I'm not completely sure, but this hack might help:
<Switch>
<Route path="/" component={IndexPag} />
<Router path="/auth/:rest*" base="/auth">
<Route path="/login" component={LoginPag} />
</Router>
<Route>Not found </Route>
</Switch>
Though, I would still prefer the v3.
Thanks @molefrog for the clarifications! It's true that Switch doesn't seems to be supported with a Router inside, i think that my previous experience with old versions of react-router-dom contributed to the confusion.
Cheers!
Hi, i created an example of the issue. If you try matching "/anything" or "/auth/whatever" it doesn't match with the last one that contains the "Not found" text.
Try commenting the... block to see the expected behaviour.
I'm using Google Chrome 120.0.6099.71 on Ubuntu 22 (not sure if is relevant data).
https://replit.com/@CodingReaction/WouterNoMatchError
Did i miss something on the Docs? Thanks.