Next.js Discord

Discord Forum

Layout using Theme Provider with "use client" makes the whole site to "use client"?

Answered
Tomistoma posted this in #help-forum
Open in Discord
TomistomaOP
Hi there! Let me ask you a question, please. To use the package next-themes to use Dark Mode, it is needed to use a Theme Provider with "use client" and apply it to the layout.tsx. Does that make the whole site to use "use client"? I'm following these steps: https://ui.shadcn.com/docs/dark-mode
Answered by alfon
to set it up correctly: make sure server components are in the children of client components NOT imported inside client components.
View full answer

3 Replies