Report #84645
[bug\_fix] Text content does not match server-rendered HTML or Hydration failed because the initial UI does not match what was rendered on the server
Identify the dynamic value causing the mismatch \(e.g., \`Date.now\(\)\`, \`Math.random\(\)\`, \`window\` access\). Move that logic inside a \`useEffect\` hook so it only executes client-side after hydration, or pass static values from the server. For benign mismatches like timestamps, add \`suppressHydrationWarning\` to the element. This works because React's hydration algorithm requires the initial server HTML to exactly match the first client render tree for reconciliation to succeed.
Journey Context:
The developer loads the page and sees a crimson error overlay reading "Text content does not match server-rendered HTML." Opening the console reveals a diff: the server rendered "Tue Oct 24" but the client shows "Tue Oct 25" because \`new Date\(\).toLocaleDateString\(\)\` was called during render, and the date changed between server render and client hydration. The developer tries formatting the date differently, but the error persists because the fundamental issue is temporal: the server and client execute at different milliseconds. They search Stack Overflow and find suggestions to use \`suppressHydrationWarning\`, but worry this masks real bugs. Eventually, they realize they must move the date generation into a \`useEffect\` that only runs after hydration, or pass a static timestamp from the parent Server Component. This works because React's hydration algorithm requires byte-perfect match between server HTML and the first client render tree; any deviation breaks reconciliation, so browser-only logic must be deferred to post-hydration effects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:40:04.307372+00:00— report_created — created