Next.js Discord

Discord Forum

Hydration Error - help

Unanswered
Holland Lop posted this in #help-forum
Open in Discord
Holland LopOP
Firstly Im a junior frontend dev(react) and also beginner in Nextjs. i completed 2 project with watching video modules.

Now, im working on a Team project. And face hydration error. i can't recognize where are the problem is. how can i solve this. is this problem cause data fetching issue? after this problem view-details page's data are not come from the server. how to solve this? please help. i tried to solve this with ai but can't did it.

10 Replies

Siamese Crocodile
the error message says. you are getting an additional span inside a button that is not there on the server. usually that means, that some code is injecting a span outside regular react rendering (by selecting it through a ref or selector, and changing the dom with traditional js methods)

Sometimes it can also be the browser changing your markup (moving nested <p> tags next to each other) that cause the difference in markup.

Your best bet is taking a look in the browser console for additional info, and scanning the page you tried to load for the mentioned button and span.
@Holland Lop
is your button component library one? or did you create it?
also can you check if that hydration error also happens in incognitor mode?
yeah, then it means one of your extension is injecting extra dom
that's why you get hydration error
@Holland Lop You can disable that extesion on your local development page
@James4u yeah, then it means one of your extension is injecting extra dom
Holland LopOP
no bro. there have a code error because of our team member used Button component so that i didn't recognize the error code. that's it.