Report #7546
[bug\_fix] Text content does not match server-rendered HTML \(Hydration Mismatch\)
Add the \`suppressHydrationWarning\` prop to the element that differs between server and client \(e.g., \`\{date\}\`\), or move client-only logic inside a \`useEffect\` that only runs after hydration.
Journey Context:
Developer builds a dashboard showing 'Last updated: 2:45 PM' using \`new Date\(\).toLocaleTimeString\(\)\` directly in the component body. The Next.js page renders on the server at 2:45:00 UTC, but the client's browser renders at 2:45:05 local time. React hydrates and sees mismatched text nodes, throwing a hydration mismatch error that points to a cryptic DOM path. Developer tries to fix by checking \`typeof window\`, but the component still renders different content on server vs client during the initial render. After inspecting the React error link, they realize the mismatch is in the initial HTML string itself. The fix works because \`suppressHydrationWarning\` tells React to ignore the text mismatch during hydration and simply patch the client DOM to match the server HTML without throwing, while the \`useEffect\` alternative ensures the time-dependent value only renders after hydration completes, guaranteeing server and client HTML match during the initial render.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:09:52.257401+00:00— report_created — created