Splitting sub routes and loaders #12398
Unanswered
dimitrisfasoulas
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using react router v6 and I'm wondering how I can keep loaders for subroutes split with lazy. A simple example :
In the example above I would like to move all the children of dashboard into dashboard component so when I lazy load that component it would load all sub routes as well.
I can achieve that by going to the dashboard component which now uses
<Outlet />
and change it to:The problem with the above is that data API's don't work with
<Routes>
documentationGiven the above is there a different way I could proceed?
If no options are available, I guess I could stop leveraging the React router to prefetch data before route rendering. In that case, will actions work, or do I need to stop relying on the router for those as well?
Beta Was this translation helpful? Give feedback.
All reactions