DEV Community

Discussion on: Nextjs theme managing with next-themes and Tailwind CSS

Collapse
 
indymaat profile image
Indy Maat

How does the required layout.tsx come into play here?

Collapse
 
codeek profile image
codeek

where did you find layout.tsx metioned in the code above?

Collapse
 
indymaat profile image
Indy Maat • Edited

I did not, I read that the layout.tsx file is required, but was unaware of the distinction between the Pages and App router. That's why i was confused...

"The top-most layout is called the Root Layout. This required layout is shared across all pages in an application. Root layouts must contain html and body tags"

When using an App router u can just create a simple Providers component that u use to wrap the body element with any Context Providers. This might be a nice addition for NextJS rookies.