From my understanding:
- <Route loader...> "only works if using a data router"
- data routers (like createBrowserRouter) don't allow for wrapping 'all' of the routes in jsx containing <Link> components. See examples
Example: Non data routers
<Router>
<header>
<Link to="/">Home</Link>
</header>
<Routes>
<Route...>
<Route...>
</Routes>
</Router>
Example: data routers (throws error) full example
const router = createBrowserRouter([....]);
<div>
<header>
<Link to="/">Home</Link>
</header>
<RouterProvider router={router} />
</div>
My question is this: How can we create a template that wraps the RouterProvider (and all the content it imports) with a template that makes use of <Link> functionality?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/mzEuqFG
Comments
Post a Comment