-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Multiple optional segments #929
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
Comments
Yes correct, there is no support for matching using regular expressions currently. I'm not sure about this, but I think you cannot have multiple dynamic segments. A possible solution would be to just move the optional params like sorting and pagination into query params, because they are actually part of a query, not directly of the URI. |
You can always do whatever crazy stuff you want in splat paths anywhere in the hierarchy. <Route path="list" handler={List}>
<Route path="*" handler={GoNuts/>
</Route>
class GoNuts extends React.Component {
render () {
var stuff = parseThatCrazyUrl(this.context.router.getCurrentPath());
// do some branching on stuff to render what you want
}
} |
And loose the ability to bookmark, share link, etc :( |
I couldn't find that in the docs. Is it possible to define a single route which has multiple optional segments? Let's say I have a list with optional sorting and pagination so I'd like to define route like:
/list?(/s/:sort?(/:order)?)?(/page/:page)?
. The other thing is matching segments by RegExp, so in the above example the parameter:order
could only have valuesasc
ordesc
. From what I found in Issue #142 there was no matching feature implemented, is that right? For now I ended up with defining 4 different routes pointing to the same handler depending on uri, which is not the optimal solution...The text was updated successfully, but these errors were encountered: