How to debug "Hydration failed because initial UI does not match what was rendered on the server" ?

Loading question...

<div> or <p> inside another <p>, or forgetting a <tbody> inside a <table>.window, localStorage, or document directly in the render body; move these into a useEffect hook.new Date()) or random numbers (Math.random()) aren't generated during the initial render, as the values will change between the server and the client.<div> inside a <p>), using non-deterministic values like Math.random(), or accessing browser-only globals like window during the initial render—causes React to lose sync. To resolve this, you must ensure your markup follows strict HTML specifications and wrap any client-side-only logic or browser API calls inside a useEffect hook or a useState toggle that only triggers after the component has mounted on the client.Math.random(), new Dates() and something like that.