Error library / this error
How to fix it
Hydration failed because the initial UI does not match what was rendered on the server.
What it means
The HTML the server produced differs from what React rendered first in the browser, so React cannot attach to it cleanly.
Common causes
- Rendering values that differ between server and browser: Date.now(), Math.random(), time zones, locale formatting.
- Reading localStorage, window size or cookies during render.
- Invalid HTML nesting, such as a div inside a p.
- A browser extension that edits the page before React loads.
How to fix it
1. Render browser-only values after mount
const [now, setNow] = useState<string | null>(null);
useEffect(() => setNow(new Date().toLocaleString()), []);
return <time>{now ?? ''}</time>;
2. Fix invalid nesting
Block elements such as div and ul cannot sit inside p. Browsers repair them, and the repaired HTML no longer matches.
3. Silence a known-safe difference
For a single element whose text legitimately differs, such as a timestamp:
<span suppressHydrationWarning>{time}</span>
4. Test without extensions
Open the page in a clean profile to rule out an extension.
Catch it the moment it happens
ErrorBell shows a dot on the page when this error occurs and takes you to the failing line, so you do not have to hunt through the console. Add it to Chrome, it is free.