Skip to content

Unable to display outlet context data in child component #11584

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

You must be logged in to vote

Each Outlet renders sets the context again, so DashboardLayout can access the RootLayout context value, but IndexPage will get the context value from DashboardLayout and not RootLayout.

You need to read and set it again in DashboardLayout, or use a custom context that you set render the provider in RootLayout and then can read it in IndexPage.

Also, if you're using Outlet context to read the RootLayout data, and that data comes from the loader, you can use useRouteLoaderData instead of Outlet.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dMaisnam
Comment options

Answer selected by dMaisnam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants