A React hydration error means the HTML your server sent does not match what the components produced on their first render in the browser. React discards the server HTML for that part of the page and renders it again on the client. In development the console prints a diff naming the node. Fix the cause it points to.
What is reported as observed below comes from tests run in December 2026: React and React DOM 19.3.1, renderToString on Node 24.12 with the server clock on UTC, and hydrateRoot in the Chromium 149 build that Playwright 1.61.1 drives. No framework was involved, so none of it was run inside Next.js.
What does a React hydration error mean?
Hydration is React attaching to HTML that already exists. It renders your components, walks the DOM beside them, and expects every element and every piece of text to be the one it would have created. When one is not, the development build reports an error that opens:
Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client.
The word after “rendered” is text when a string differs and HTML when an element is different or missing. A production build has neither the prose nor the diff. It reports Minified React error #418 with a link ending errors/418?args[]=text&args[]=, and that first argument is the same word.
A second message is easier to miss. It is a console.error that begins A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. The test bore that out. A link rendered with href="/server" on the server and href="/client" in the browser still pointed at /server after hydration, and the production build logged nothing for it. A wrong attribute can stay in the page with no report at all.
What does React do after a mismatch?
It renders the tree again from scratch, up to the nearest <Suspense> boundary. With the mismatch in a paragraph and no boundary above it, React replaced everything in the root. The <h1> beside the paragraph was a new DOM node afterwards, and text typed into an <input> before hydration was gone. With the same paragraph inside <Suspense>, only the boundary’s content was replaced: the heading was the original node and the typed text was still there.
The React docs warn of worse: “In the best case, they’ll lead to a slowdown; in the worst case, event handlers can get attached to the wrong elements.”
How do you read the diff?
Take a component that formats a date.
const due = new Date('2026-06-15T23:30:00Z');
export function DueDate() {
return <p>Due {due.toLocaleDateString('en-GB')}</p>;
}
The locale is pinned. The time zone is not, so the server formats in its own zone and the browser in the visitor’s. Rendered on the UTC server and hydrated in a browser set to Europe/London, the development message ended with this:
<DueDate>
<p>
+ 16/06/2026
- 15/06/2026
Lines marked + are what the client rendered and lines marked - are what the server’s HTML held. The tree above them is the path to the node. React has printed this diff since version 19.
The same component hydrated cleanly in a browser set to UTC. With other dates it would pass for a London visitor all winter, and in summer fail only in the last hour of the UTC day, when London is already on tomorrow’s date.
Which causes produce a mismatch?
React’s message lists five. Four are your code giving two answers: a branch on typeof window, a call such as Date.now() or Math.random() during render, date formatting in the visitor’s locale, and external data that changed with no snapshot sent in the HTML. I ran the first and the third, and the diff showed both strings each time.
The fifth, invalid nesting, is different because the components agree with each other. The server sent <p id="p"><div id="d">inside</div></p>. A <div> cannot sit inside a <p>, so by the time React looked, the browser’s parser had turned it into <p id="p"></p><div id="d">inside</div><p></p>. Development logs In HTML, <div> cannot be a descendant of <p>. ahead of the hydration error, and that earlier line names the element to move.
Then there is code that is not yours. I stood in for a browser extension by editing the DOM from a script before calling hydrateRoot, and the result depended on where the edit landed.
| Change made before hydration | Result |
|---|---|
Element added to <head> or <body> with React rendering the whole document, or directly inside the root container | Skipped. No message, element still there. |
Attribute added to <body> with React rendering the whole document, or to an element inside the tree | Attributes warning in development, nothing in production. Attribute stayed. |
Element inserted inside a nested <div>, or the text of a <p> rewritten | Full hydration error. Tree regenerated, edit gone. |
The first row matches what React 19 announced for third-party scripts and extensions in <head> and <body>. The third row would explain a production report that cannot be reproduced in a clean profile. A <Suspense> boundary contained those edits too, with the rest of the page left alone.
Next.js has its own page for this error, which adds causes I did not test: a misconfigured CSS-in-JS library, a CDN that modifies the HTML response, and iOS turning phone numbers into links.
How do you fix a value only the browser knows?
First check whether the browser has to decide at all. If the date is a UK deadline, say so on both sides: toLocaleDateString('en-GB', { timeZone: 'Europe/London' }) gave 16/06/2026 on the UTC server and in a browser set to Pacific/Auckland, with no error. Our posts on adopting the Temporal API and formatting currency with Intl.NumberFormat cover naming the zone and picking the locale on the server.
When the value does belong to the visitor, render it only in the browser. React 19.3.0, released on 9 September 2026, added an API for this: browser, imported from react-dom.
import { Suspense, use } from 'react';
import { browser } from 'react-dom';
const due = new Date('2026-06-15T23:30:00Z');
function LocalDueDate() {
use(browser('formats the date in the visitor time zone'));
return <p>Due {due.toLocaleDateString('en-GB')}</p>;
}
export function DueDate() {
const london = due.toLocaleDateString('en-GB', { timeZone: 'Europe/London' });
return (
<Suspense fallback={<p>Due {london} UK time</p>}>
<LocalDueDate />
</Suspense>
);
}
On the server, use(browser()) stopped LocalDueDate and the HTML carried the fallback, Due 16/06/2026 UK time. In a browser set to America/New_York the paragraph read Due 15/06/2026 once hydration finished. Neither build reported an error and nothing reached onRecoverableError. The call has to sit under a <Suspense> boundary. Without one, renderToString threw The server render could not complete because client rendering was requested outside a Suspense boundary.
On older versions the documented route is two passes: render the server’s value, then set state in useEffect and render again. That produced no error either, though the docs warn that it “makes hydration slower because your components have to render twice”. useSyncExternalStore with a getServerSnapshot argument also hydrated cleanly, then switched to the client value. Next.js documents next/dynamic with ssr: false too.
suppressHydrationWarning silences the error and corrects nothing. On a <time> element whose text differed, the server’s text stayed, and it was still there after a later state update re-rendered the component. The prop reaches one element deep: the same mismatch inside a child <span> failed as before. It suits text where the server’s value is fine to leave on screen.
How do you catch it in production?
By default React passes a recoverable error to the browser’s reportError, and in these tests it arrived as an uncaught error on the page. A tracker that listens for those should be collecting #418 already. To attach the component stack, pass onRecoverableError:
import { hydrateRoot } from 'react-dom/client';
import { DueDate } from './due-date.jsx';
hydrateRoot(document.getElementById('root'), <DueDate />, {
onRecoverableError(error, errorInfo) {
navigator.sendBeacon('/client-errors', JSON.stringify({
message: error.message,
componentStack: errorInfo.componentStack,
url: location.href,
}));
},
});
With the broken DueDate in a production build, the beacon carried the #418 message and a componentStack of at p followed by at id. The element kept its tag name, and id is what the minifier had renamed DueDate to. With the handler set, nothing went to the console. An attribute mismatch never reached the handler in either build.
I would read the diff before choosing any of these, because the cause decides the fix. A value the server can decide gets decided there. One it cannot goes under a <Suspense> boundary with use(browser()) on 19.3 or later, and behind the two-pass effect on anything older. The warning I would not chase is the attributes one pointing at something on <body> that you never wrote: open a profile with no extensions and, if it has gone, leave it.
Whoooop builds front-ends in React and takes on existing React apps, fixing what is broken and updating what has gone stale. The React development page sets out the work.