-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[added] Greedy splat (**) #2401
Conversation
thank you! great work 😄 |
@knowbody thanks! I'm glad that I contributed to react-router 😄 |
Nice job 😄 |
Looking at this a little, do you think it'd be worth adding a caveat saying that e.g. <Route path="**">
<IndexRoute />
<Route path="foo" />
<Route path="bar" />
</Route> will only ever match the index route? It should be obvious, but you never know. |
I think it's a good idea @taion |
There's already an open issue to add a warning about unreachable routes. We
|
Actually, can you reach any routes under splats? It looks like even <Route path="*">
<IndexRoute />
<Route path="foo" />
<Route path="bar" />
</Route> can't match the non-index routes because of https://github.com/rackt/react-router/blob/v1.0.0-rc3/modules/PatternUtils.js#L84-L87. This splat stuff and the implicit coercion of repeated route params to arrays is pretty confusing IMO. |
As discussed #2284, this pull request add support to greedy splat
**
.Example of matching:
Fix #2284