Home > Web Front-end > JS Tutorial > Hydration error when installing NextJS 15

Hydration error when installing NextJS 15

DDD
Release: 2024-11-21 22:33:15
Original
950 people have browsed it

After creating a new next 15 project and

npm run dev
Copy after login

if see these error in your development server:

Hydration error when installing NextJS 15

Hydration error when installing NextJS 15

Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used

  • A server/client branch if (typeof window !== 'undefined').
  • Variable input such as Date.now() or Math.random() which changes each time it's called.
  • Date formatting in a user's locale which doesn't match the server.
  • External changing data without sending a snapshot of it along with the HTML.
  • Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

Here is the solve

use this suppressHydrationWarning attribute in your layout.tsx file

return (
    <html lang='en' suppressHydrationWarning>
Copy after login

if this doesn't solve your problem, then So far these are the mentioned extensions that cause hydration errors I have seen here. You guys can add up further names to gather them in a single place to help other fellow devs:

1 - ColorZilla

2 - Wappalyzer

3 - Urban VPN

4 - LastPass

5 - Hacker Vision

6 - WhatFont

7 - Video Speed Controller for HTML videos

8 - Glot

9 - AI Grammar Checker & Paraphraser – LanguageTool

10 - Grammarly

11 - Invert

12 - Dashlane

Happy Coding :)

The above is the detailed content of Hydration error when installing NextJS 15. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template