Report #31148
[bug\_fix] Text content does not match server-rendered HTML \(Hydration mismatch\)
Add the \`suppressHydrationWarning\` prop to the element that differs \(e.g., \`\{new Date\(\).toString\(\)\} \`\), or wrap client-only content in a \`useEffect\` hook with a mounted state check to prevent server/client HTML divergence.
Journey Context:
Developer sees a red error overlay in Next.js dev mode showing a hydration mismatch. Inspecting the console reveals that text content differs between the server HTML and client HTML. They realize the mismatch is caused by a browser extension \(like Grammarly or LastPass\) injecting spans into the DOM, or by using \`Date.now\(\)\` or \`Math.random\(\)\` during the render phase. They try conditional rendering with \`typeof window \!== 'undefined'\`, but the error persists because the component still renders different HTML on the server versus the client during the initial hydration pass. Adding \`suppressHydrationWarning\` tells React to ignore the mismatch for specific benign cases \(like timestamps\), while the \`useEffect\` pattern ensures the server renders a placeholder and the client only renders the dynamic content after hydration completes, guaranteeing the initial HTML matches and preventing hydration mismatches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:40:17.928039+00:00— report_created — created