You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In v5 deeply nested <Route path="/absolute/path"> matched the parent portion of the URL, but in v6 deeply nested <Routes> build upon the previous path and won't match an absolute path.
To facilitate easier migrations to v6 as well as allow people to have centralized route tables with absolute paths, you can use <AbsoluteRoutes> as a replace for <Routes>.
For example:
// High up the tree:<Routes><Routepath="admin/*"/></Routes>// ✅ deeper in the tree uses relative paths that build on /admin/<Routes><Routepath="users"/><Routepath="settings"/></Routes>// ❌ does not work today<Routes><Routepath="/admin/users"/><Routepath="/admin/settings"/></Routes>// ✅ will work now with AbsoluteRoutes<AbsoluteRoutes><Routepath="/admin/users"/><Routepath="/admin/settings"/></AbsoluteRoutes>
Again, this will facilitate migrations from v5 as well as allow folks to use centralized route tables:
constroutes={admin: "/admin/*",users: "/admin/users/:userId"}<Routes><Routepath={routes.admin}/></Routes>// and then inside the tree of the admin route<AbsoluteRoutes><Routepath={routes.users}/></AbsoluteRoutes>
The text was updated successfully, but these errors were encountered:
Maybe we could change a bunch of the context internals, but this little component can be done w/o changing anything, in fact it could done in userland. Always a tradeoff, we'd rather not mess with how context/matching work when the behavior can be composed instead.
In v5 deeply nested
<Route path="/absolute/path">
matched the parent portion of the URL, but in v6 deeply nested<Routes>
build upon the previous path and won't match an absolute path.To facilitate easier migrations to v6 as well as allow people to have centralized route tables with absolute paths, you can use
<AbsoluteRoutes>
as a replace for<Routes>
.For example:
Again, this will facilitate migrations from v5 as well as allow folks to use centralized route tables:
The text was updated successfully, but these errors were encountered: