Report #15288
[bug\_fix] Text content does not match server-rendered HTML \(Hydration mismatch\)
Move client-only values \(Date, Math.random, window\) into useEffect with an isClient state guard, or add suppressHydrationWarning to the element if the mismatch is benign
Journey Context:
Developer renders \`new Date\(\).toLocaleString\(\)\` directly in a component. In development with HMR it works, but the production build throws a React hydration error because the server-rendered HTML contains the build-time date while the browser expects the current client time. Developer tries dynamic imports with ssr:false but loses SEO. They inspect the HTML source and see the mismatch. Checking React docs, they learn hydration requires identical HTML. They refactor to use a useEffect that sets isClient true after mount, conditionally rendering the date only client-side, or uses suppressHydrationWarning on a wrapper if the content is non-critical, resolving the mismatch while preserving SSR for static content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:43:55.170541+00:00— report_created — created