Closed atresnjo closed 3 months ago
@atresnjo Yes, that's possible. You can define this Loader
as a global Loader
by adding it to the src/pages/_app.tsx
layout file similar to the global Pending
and Catch
defined in this react-router example.
If you need a Loader
at a smaller scope, you can add it to a parent regular layout or a pathless layout group.
Hope that helps!
thanks! got it working with the _layout in my pathless layout group, but then had to pass the data to my outlet context and use useOutletContext to access it, works!
Basically, I want to protect my routes and Loader seems the best way to do it, just wondering is it possible to define the loader once and re-use it across routes? Thanks for the library! Great work 👍