Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Next.js hydration error means the HTML rendered on the server does not match what React produces during the browser’s first render. Find the first differing element or value, make that initial output deterministic, and reserve browser-only rendering or warning suppression for cases that truly need it. Adding "use client" alone does not prevent the mismatch: Client Components are still prerendered on an initial visit.

What a hydration error means

Next.js prerenders HTML on the server, then React hydrates it in the browser by attaching event handlers. For hydration to work, the component tree and content from the browser’s initial render must agree with the prerendered HTML. If they differ, React reports a hydration mismatch. See the Next.js hydration error reference.

This applies to both routers: Pages Router pages are prerendered by default, and in the App Router, Client Components are also prerendered on an initial visit. A "use client" boundary enables client-side features; it is not permission for the initial browser output to differ from the server output. The Next.js Server and Client Components guide notes that Client Components are rendered entirely on the client during subsequent navigations.

Find the first mismatch

  1. Read the complete browser warning. Note the route, element, and value it identifies. Reproduce the issue with the same route, data, and browser or device when possible.
  2. Compare the server value with the initial browser value. Look at the rendered HTML and the component’s first-render logic; do not compare against what the page looks like after effects have run.
  3. Check markup validity first. Look for nested paragraphs, a <div> inside a <p>, or nested interactive elements such as links and buttons. Invalid nesting can cause the browser to parse a DOM tree different from the one React expects.
  4. Search render code for environment-dependent values. Inspect uses of typeof window, window, localStorage, current-time reads such as Date(), and Math.random(). Ask whether the server and browser can produce different output from the same component on its first render.
  5. Check changes outside the component. Try a clean browser profile or disable extensions that modify pages. Review CSS-in-JS setup against the official integration guidance for your installed Next.js version, and check whether a CDN feature such as Cloudflare Auto Minify transforms HTML.

Fix common causes

Correct invalid HTML nesting

Restructure the JSX so the generated HTML follows valid nesting rules. For example, do not place a paragraph inside another paragraph or a block-level <div> inside a paragraph. Avoid nesting interactive controls. The browser may repair invalid markup while parsing it, leaving React to hydrate a DOM that no longer matches its expected tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Move browser-only reads out of the initial render

Code such as typeof window !== 'undefined' inside render can make the server and browser return different markup. Likewise, browser APIs such as window and localStorage should not determine server-rendered output. When the value is needed only in the browser, read it in an effect or in response to an event, then update the UI after hydration.

"use client";

import { useEffect, useState } from "react";

export function SavedSetting() {
  const [setting, setSetting] = useState(null);

  useEffect(() => {
    setSetting(window.localStorage.getItem("setting"));
  }, []);

  return <p>{setting ?? "Loading setting…"}</p>;
}

The initial server and browser output in this example is the same placeholder; the browser-specific value appears after the effect runs. Choose a placeholder that makes sense for your interface, and account for the possibility that the stored value is absent.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Handle current time and randomness deliberately

A timestamp or random value can differ between server prerendering and browser hydration. If that content can wait, render a stable fallback first and reveal the dynamic value after hydration. For supported prerender cases involving these APIs, Next.js documents fallback-boundary and effect or event-handler approaches in its guides for current-time access and random values. Use the pattern that matches the component and the installed Next.js version rather than generating a different value in each initial render.

Account for browser or infrastructure mutations

Browser extensions can alter HTML before React hydrates it. On iOS, automatic detection can turn phone numbers, email addresses, dates, or addresses into links; if that is the cause, Next.js documents using a format-detection meta tag to disable the relevant conversion. Also inspect HTML-changing CDN settings and styling-library configuration. Match the CSS-in-JS setup to the official instructions for your Next.js version instead of changing markup to work around a style configuration issue.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

When to disable prerendering for a component

If a component genuinely cannot render meaningfully without browser APIs, isolate that component and selectively disable its prerendering. This is a scoped option for browser-dependent UI, not a general fix for every hydration warning. Keeping the rest of the page prerendered avoids giving up server rendering more broadly than necessary. Follow the applicable Next.js guidance for the installed version.

Use warning suppression only for a narrow, unavoidable difference

suppressHydrationWarning is an escape hatch for a localized mismatch, such as text that necessarily differs between server and browser. Next.js says it works one level deep; when applied, React will not patch mismatched text. It does not make the underlying output consistent or repair arbitrary tree differences, so first fix the source whenever possible. Use suppression only when the difference is intentional and cannot reasonably be removed.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Investigate prerender errors during a build

If the problem appears as a build-time prerender error, inspect the build output and use next build --debug-prerender for unminified stack traces with source maps. This command is documented for diagnosing prerender errors; it is not a universal tool for debugging every hydration warning shown in a browser console. See Next.js prerender error guidance.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Choose the fix by cause

What differs First fix to try
HTML structure or browser-parsed DOM Correct invalid nesting and nested interactive elements.
Browser API or environment check Keep the initial output stable; read the browser value in an effect or event handler.
Current time or randomness Use an appropriate stable fallback or defer the value to an effect or event handler.
Browser extension, iOS detection, or CDN transformation Confirm the external mutation, then adjust the relevant browser, metadata, or infrastructure setting.
CSS-in-JS mismatch Verify the integration setup for the installed Next.js version.
Component requires browser APIs to render Isolate it and selectively disable its prerendering.
Intentional, unavoidable localized text difference Consider suppressHydrationWarning narrowly, knowing the text will not be patched.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.