Report #104618
[bug\_fix] Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client.
Ensure the initial render on the server and client produce identical output. Remove non-deterministic values \(e.g., \`Date.now\(\)\`, \`Math.random\(\)\`, \`window\` access\) from the initial render. For client-only logic, use \`useEffect\` to update state after mount, or use a \`suppressHydrationWarning\` attribute only for intentional differences \(like timestamps\).
Journey Context:
I was building a dashboard with a live clock. The page loaded fine in dev but threw a hydration mismatch in production. I spent hours checking CSS and component order, then realized the clock component rendered \`new Date\(\).toLocaleTimeString\(\)\` directly in the JSX. The server rendered one time, the client rendered a different time \(milliseconds later\), causing the mismatch. The fix was to initialize the time state to \`null\` and set it in \`useEffect\` \(which runs only on the client\), so both server and client render the same placeholder initially. This is the canonical React pattern for client-only values.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-13T20:06:07.069109+00:00— report_created — created