Next.js Discord

Discord Forum

my nextjs app error - layout.tsx

Answered
Egyptian Mau posted this in #help-forum
Open in Discord
Egyptian MauOP
hello everyone, working on the nextjs project where i am getting this error.
tried syppressHydrationWarning
tried to remove all extensions
the issue persists the same
any other idea to resolve this
Answered by joulev
putting syppressHydrationWarning in the html tag should fix this, but putting it anywhere else won't fix this.
View full answer

7 Replies

putting syppressHydrationWarning in the html tag should fix this, but putting it anywhere else won't fix this.
Answer
Egyptian MauOP
actually it doesnt solves the problem but it just hides the problem the issue is the same.
@Egyptian Mau actually it doesnt solves the problem but it just hides the problem the issue is the same.
well, the problem is fundamentally unfixable as long as you use localStorage (which next-themes use). the server doesn't have the localStorage value so cannot render the content correctly according to the configured theme, and there will inevitably be mismatches between the server and the client.
syppressHydrationWarning is the solution to this problem (and a few other problems related to SSR, for example rendering localised date formats)