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
6.15.0
import { matchPath } from 'react-router-dom'; const test1 = matchPath('/profile/:id?', '/profile/ABC-123'); const test2 = matchPath('/profile/:id', '/profile/ABC-123') console.log(test1) // null console.log(test2) // PathMatch object
Call matchPath using a path pattern that ends in an optional segment, and a location pathname that includes the optional segment.
matchPath
I would expect matchPath to return a match object for both scenarios.
/profile/:id?
/profile/ABC-123
/profile/id
matchPath returns null for scenario test1.
null
test1
const test1 = matchPath('/profile/:id?', '/profile/ABC-123') console.log(test1) // null
The text was updated successfully, but these errors were encountered:
This was resolved in 6.18.0 via #10768
Sorry, something went wrong.
No branches or pull requests
What version of React Router are you using?
6.15.0
Steps to Reproduce
Call
matchPath
using a path pattern that ends in an optional segment, and a location pathname that includes the optional segment.Expected Behavior
I would expect
matchPath
to return a match object for both scenarios./profile/:id?
should return a match object for path/profile/ABC-123
/profile/id
should return a match object for path/profile/ABC-123
Actual Behavior
matchPath
returnsnull
for scenariotest1
.The text was updated successfully, but these errors were encountered: