Search code examples
reactjscreate-react-app

React version 19 error : Hydration failed because the server rendered HTML didn't match the client


I am new to React JS and got a setup of react application through :

npx create-next-app@latest projectname

after taking lots of minute, setup completed with error :

Errors occured while react setup

i tried to google this error but didn't found any specific solution. Please help..!!

I tried to setup a react application and was expecting it to run smoothly as per documentation provided on https://react.dev/learn/start-a-new-react-project

In package.json :

React js version is 19.0.0

Next js version is 15.1.2

Below is the code of src\app\page.js :

<div className="demo"> Hello world </div>

Solution

  • This type of error often occurs when you use an unsymmetrical element that is not intended to be used in a certain way, such as wrapping a <p> tag inside another <p> tag. You can read more about it here:

    1 of the solution provided in second documentation is :

    suppressHydrationWarning
    

    i have added this option in top most parent tag and error gone.