How to identify when the next.js hydration finishes hydration on client side? #18271
-
We need to change DOM content on certain html elements when the next.js finishes hydration of the page. Is there an event which we can listen to make this change post-hydration? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You should be able to use |
Beta Was this translation helpful? Give feedback.
-
useEffect runs even when hydration is not yet complete. At least in next.js 14 and react 18. I don't know who came up with this brilliant (not) idea. |
Beta Was this translation helpful? Give feedback.
You should be able to use
useEffect
for this!useEffect
does not run on the server, so that would be a good choice to run some code after the client loads.