my nextjs app error - layout.tsx
Answered
Egyptian Mau posted this in #help-forum
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
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.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.
@joulev putting `syppressHydrationWarning` in the `html` tag should fix this, but putting it anywhere else won't fix this.
Egyptian MauOP
yeah i did put in the html tag only
@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)@joulev 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.
Egyptian MauOP
okay understood the problem. thanks for guiding