Next.js Discord

Discord Forum

Error with ThemeProvider from next-themes

Unanswered
Ocicat posted this in #help-forum
Open in Discord
Avatar
OcicatOP
Hello, I'm using the latest version of nextjs with typescript and tailwindcss, I'm trying to implement a light/dark mode to my project but I get an error in the “providers.tsx”. The import is done correctly but it has trouble with the {children}, I think it's a typing error with typescript or JSX.

Anyone knows the solution ? Thanks in advance

providers.tsx and layout.tsx in media ->
Image
Image

5 Replies

Avatar
Australian Freshwater Crocodile
Weird, I also have the latest Next.js version (also latest on TailwindCSS and next-themes) and i tried with your code and it works
Image
Unless you're talking about latest canary version, i have the latest stable: v.15.1.5