Report #12871
[bug\_fix] Text content does not match server-rendered HTML
Wrap the client-dependent value \(Date, Math.random, window\) in a useEffect that only runs after hydration, or add suppressHydrationWarning to the element if the mismatch is unavoidable \(like a timestamp\). The root cause is that React's hydration requires the initial client render to exactly match the server HTML; any deviation in content creates a mismatch.
Journey Context:
You deploy a dashboard showing 'Last login: \[timestamp\]' and immediately see a red console error: 'Text content does not match server-rendered HTML'. Inspecting the Elements panel, you see the server sent 'Last login: 10:00 AM' but React expected 'Last login: 10:00:05 AM'. You try wrapping it in typeof window \!== 'undefined' but the error persists because that check runs during the initial client render, still mismatching the server HTML. You search the React docs and learn that useEffect runs after hydration, so moving the date logic there ensures the server and initial client HTML match \(both showing a placeholder or nothing\), then the effect updates it client-side.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:14:00.810814+00:00— report_created — created