← All errors · Next.js

Text content does not match server-rendered HTML

Exact error

Warning: Text content did not match. Server: "..." Client: "..."

What it means

A text node rendered differently on the server and in the browser. It is the same class of problem as a hydration failure, narrowed down to text.

Likely causes

How to fix it

  1. Format dates with an explicit time zone and locale so server and client agree:

    new Intl.DateTimeFormat('en-US', { timeZone: 'UTC', dateStyle: 'medium' }).format(date)
  2. For stable IDs, use React's useId() instead of Math.random():

    import { useId } from 'react';
    const id = useId();
  3. Defer client-only values to useEffect (see the hydration failed fix).

Related errors

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy