Hydration Error - help
Unanswered
Holland Lop posted this in #help-forum
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.
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.
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.
@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 LopOP
i've solved the problem by investigte more deeply. but doesn't solved: sometimes data comes and sometimes doesn't. im using same deployment for backend and frontend.
@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?
@James4u also can you check if that hydration error also happens in incognitor mode?
Holland LopOP
issue solved bro.
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.