#ThemeProvider from next-themes cannot be used in root.tsx (hydration-mismatch)

1 messages · Page 1 of 1 (latest)

noble mantle
#

I put ThemeProvider from next-themes into <body> in the Layout component in root.tsx:

    <ThemeProvider
      attribute="class"
      defaultTheme="system"
      enableSystem
      disableTransitionOnChange
    >
      {children}
    </ThemeProvider>

and it started triggering the following error:

A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:

Any clue?

noble mantle
#

Someone?

lofty flume
noble mantle
#

!close

#

hm