DEV Community

Md Wahiduzzaman Emon
Md Wahiduzzaman Emon

Posted on

Answer: React 18: Hydration failed because the initial UI does not match what was rendered on the server

Just go main parent component and set the state:

const [isSSR,setIsSSR]=React.useState(false);
React.useEffect(()=>{
  setIsSSR(true);
})
return (
  isSSR && (
    <>
       //your component here
    </>
  )
)
</p>
Enter fullscreen mode Exit fullscreen mode





https://stackoverflow.com/a/74418607/16836455

Top comments (0)