How does React Router v7 choose between two equally specific matching routes?
I'm using React Router v7 and trying to understand how route matching works when multiple routes can match the same URL with the same level of specificity. For example: <Routes> <Route path="/foo/:someVar/baz" element={<A />} /> <Route path="/foo/bar/:someOtherVar" element={<B />} /> </Routes> If I navigate to: /foo/bar/baz, both routes appear to match: /foo/:someVar/baz → { someVar: "bar" } /foo/bar/:someOtherVar → { someOtherVar: "baz" } My questions are: Which route will React Router v7 render in this case? If the ranking is the same, how is the tie resolved? I found the "Ranked Route Match
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.