Passing Theme Context into a Sever Side Component
Unanswered
Lilac posted this in #help-forum
LilacOP
The docs say we should wrap a context provider in a client component and then place it in the root.
But what if we need to pass this context like a theme or user auth info down to server components as well?
Since server components cannot use context
But what if we need to pass this context like a theme or user auth info down to server components as well?
Since server components cannot use context
8 Replies
Northern Wheatear
Actually you can do this
This is an example
Using suspense is optional there
This is the datawrapper component which gets data from db and passes it to a context provider
Then the AppLayout in my RootLayout contains the rest of the layout which needs the data from context...
LilacOP
But only client components can access context