"react-router-dom": "^5.0.1"
https://codesandbox.io/s/react-router-plhuw
Assuming props.match.url is /foo/bar, create a component:
<Link to={`${props.match.url}/../baz`}>go to baz</Link>
I would expect a transition to /foo/baz url.
Even the URL is changing to /foo/baz, react-router internally thinks the URL is /foo/bar/../baz, and fails on that.
However, if you reload a page - all works as expected.
I think that is an issue related to the history library, that React Router uses. But yes, it should resolve as much as possible.
See #5127
@timdorr Actually, there are clear answers to both questions: 1st – relative paths in <Route /> is only possible for path relative to the current location (parent location), but not to any higher level. 2nd – relative paths in <Link /> is possible to any level, because that is what is defined in the related RFC. Any other way of path resolving is unexpected and differs from the way that <a /> resolves paths.