Next.js Discord

Discord Forum

Hydration failed because the initial UI does not match what was rendered on the server.

Answered
Madeiran sardinella posted this in #help-forum
Open in Discord
Madeiran sardinellaOP
Hello guys, I've created a Navbar component for my app and on login/logout when the user is redirected back to the homepage this error get's thrown. Any ideas?

The Error:
https://prnt.sc/ND4kHdjDi3uS
https://prnt.sc/FuuC21ewVy6g
https://prnt.sc/m4wCRQXDDvLe

Recreation:
Answered by Madeiran sardinella
I fixed it. I had a /sign-in and /sign-up pages with layout.tsx in them and for some reason it confused them and I've gotten an error when redirecting from /sign-in to /
View full answer

4 Replies

There should be an error message in the browser's console showing you the Server: and Client: outputs, so you can compare them to identify the discrepancy. Dou you have a live preview or a code-snippet which can be further investigateD?
Madeiran sardinellaOP
@Kiril Peyanski виждам, че си българин, това е грешката, която получавам. (I can see that you're a bulgarian, that's the error that I get)

app-index.js:34 Warning: You are mounting a new body component when a previous one has not first unmounted. It is an error to render more than one body component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <body> and if you need to mount a new one, ensure any previous ones have unmounted first
app-index.js:34 Warning: You are mounting a new html component when a previous one has not first unmounted. It is an error to render more than one html component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <html> and if you need to mount a new one, ensure any previous ones have unmounted first.
Madeiran sardinellaOP
I fixed it. I had a /sign-in and /sign-up pages with layout.tsx in them and for some reason it confused them and I've gotten an error when redirecting from /sign-in to /
Answer