Skip to content

Root route is only rendered after child route loads? #10452

Closed Answered by danilofes
danilofes asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I just figured out this is intended behaviour. As all loaders for all active routes run in parallel, the root element is not rendered until all of them complete. To render a loading indicator for the first load scenario, one needs to pass a fallbackElement to RouterProvider:

export default function MyApp() {
  return <RouterProvider router={router} fallbackElement={<div>loading...</div>} />;
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by danilofes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant