We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to resolve routes like: /product/:name?-:id
/product/:name?-:id
that would allow routes like:
/product/wtv-3652672 /product/3652672
But this does not seem to work. What's the recommended way to conditionally include dashes ?
The text was updated successfully, but these errors were encountered:
React Router uses path-to-regexp for its route matching. You should check out its configuration options, especially custom match parameters.
path-to-regexp
<Route path='/product/:name(\w+-)?:id' ... />
You'll have to manually strip the dash off of the name, but otherwise it seems to match fine.
For future reference, you can use https://pshrmn.github.io/route-tester to test out combinations of <Route> paths and its other props.
<Route>
path
Sorry, something went wrong.
No branches or pull requests
I'm trying to resolve routes like:
/product/:name?-:id
that would allow routes like:
But this does not seem to work.
What's the recommended way to conditionally include dashes ?
The text was updated successfully, but these errors were encountered: