---
title: Text content does not match server-rendered HTML
url: "https://nextjs.org/docs/messages/react-hydration-error"
docs_index: /docs/llms.txt
---



## Why This Error Occurred

While rendering your application, there was a difference between the React tree that was prerendered from the server and the React tree that was rendered during the first render in the browser (hydration).

[Hydration](https://react.dev/reference/react-dom/client/hydrateRoot) is when React converts the prerendered HTML from the server into a fully interactive application by attaching event handlers.

### Common Causes

Hydration errors can occur from:

1. Incorrect nesting of HTML tags
   1. `<p>` nested in another `<p>` tag
   2. `<div>` nested in a `<p>` tag
   3. `<ul>` or `<ol>` nested in a `<p>` tag
   4. [Interactive Content](https://html.spec.whatwg.org/#interactive-content-2) cannot be nested (`<a>` nested in a `<a>` tag, `<button>` nested in a `<button>` tag, etc.)
2. Using checks like `typeof window !== 'undefined'` in your rendering logic
3. Using browser-only APIs like `window` or `localStorage` in your rendering logic
4. Using time-dependent APIs such as the `Date()` constructor in your rendering logic
5. [Browser extensions](https://github.com/facebook/react/issues/24430) modifying the HTML
6. Incorrectly configured [CSS-in-JS libraries](/docs/app/guides/css-in-js)
   1. Ensure your code is following [our official examples](https://github.com/vercel/next.js/tree/canary/examples)
7. Incorrectly configured Edge/CDN that attempts to modify the html response, such as Cloudflare [Auto Minify](https://developers.cloudflare.com/speed/optimization/content/troubleshooting/disable-auto-minify/)

## Possible Ways to Fix It

Ensure that the component renders the same content on the server and during the initial client render. The following approaches help when a value differs between them.

### Solution 1: Rendering client-specific values with Suspense

If the browser can reuse a server-generated value, generate it once in a Server Component and [pass it as a prop](/docs/app/getting-started/server-and-client-components#passing-data-from-server-to-client-components). Use the same formatting on the server and during hydration.

When content depends on browser-only APIs or settings, defer that rendering to the browser. With React 19.3, call `use(browser())` in a Client Component inside a parent `<Suspense>` boundary. The fallback can show useful server-rendered content or a placeholder. The `use(browser())` call suspends during server rendering; wrapping a Client Component in `<Suspense>` alone does not make it browser-only.

See the [client-specific rendering and fallback choices](/docs/app/guides/preventing-flash-before-hydration#rendering-client-specific-content).

<span id="solution-1-using-useeffect-to-run-on-the-client-only" />

For the `useEffect` workaround and its tradeoffs, see [Why not `useEffect`?](/docs/app/guides/preventing-flash-before-hydration#why-not-useeffect).

### Solution 2: Disabling SSR on specific components

Next.js allows you to [disable prerendering](/docs/app/guides/lazy-loading#skipping-ssr) on specific components, which can prevent hydration mismatches.

```jsx
'use client'

import dynamic from 'next/dynamic'

const NoSSR = dynamic(() => import('../components/no-ssr'), { ssr: false })

export default function Page() {
  return (
    <div>
      <NoSSR />
    </div>
  )
}
```

### Solution 3: Using `suppressHydrationWarning`

When you intentionally allow an element's text or attributes to differ between the server and client, such as a browser-formatted date, you can silence the hydration mismatch warning by adding `suppressHydrationWarning={true}` to the element.

```jsx
<time dateTime="2016-10-25" suppressHydrationWarning />
```

Suppression only applies one level deep, and React will not patch mismatched text content on that element. Use this escape hatch sparingly.

## Common iOS issues

iOS attempts to detect phone numbers, email addresses, and other data in text content and convert them into links, leading to hydration mismatches.

This can be disabled with the following `meta` tag:

```jsx
<meta
  name="format-detection"
  content="telephone=no, date=no, email=no, address=no"
/>
```
