function Clock() {
return <span>{new Date().toLocaleTimeString()}</span>;
}function Clock() {
const [time, setTime] = useState(null);
useEffect(() => setTime(new Date().toLocaleTimeString()), []);
return <span>{time ?? '--:--'}</span>;
}The server and the first client render both show a placeholder, and the real time is set after hydration, so the markup matches.
localStorage during render, which does not exist on the server.Date.now(), Math.random() or window checks during render.The browser must download, parse and run the JS for every hydrated component before it responds to input. Less client JS, islands or server components reduce the cost.
Only for one element whose text must differ, like a timestamp. suppressHydrationWarning works one level deep and does not fix mismatches in children.
Rendering creates DOM from scratch, while hydration reuses the DOM the server already sent and attaches event handlers and state to it.