-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deeply nested routes #257
Comments
The reason why your steps to reproduce does not work in the sandbox is fundamentally caused by the same behavior (not necessarily bug) of
My gut feeling is when the base path feature was implemented, it was not anticipated that there would be nested base paths and the current wouter version does not support it. |
I worked around this with a slight variation in his example - instead of checking against the entire base path, my nested router checks only the current one:
This lets you build arbitrarily nested structures that only know about their own level in the path (arguably, the 80% of what people really want):
I also made my own Switch variant which works with these, let me know if you're interested. |
I dug into it a little deeper and realized that while the use-location.js constructor supports a |
Fixed in #265 |
Following the docs for nested routes, it seems to be hinted at that you can nest routes logically:
However, when trying things out in the demo sandbox, this doesn't seem to be the case. Perhaps I'm doing something wrong?
Steps to reproduce
/other
to the navigation list under<Scope base='help'>
.<Scope base="/other"><p>Example text</p></Scope>
above<Route path="/topics">
.Expected result:
<p>Example text</p>
is rendered (like/topics
and/how-to
) at/help/other
.Actual result:
<p>Example text</p>
is not rendered at/help/other
.You can achieve a similar scenario by wrapping the main
<div className="App">
with<Router base='/app'>
. This will render everything up to/help
normally. There seems to be a bit of confusion as to how to achieve nested routes beyond the first level.I'd appreciate any help regarding the matter! We're trying to transition away from React Router and its backward-facing development.
The text was updated successfully, but these errors were encountered: