monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

Error: Hydration failed because the initial UI does not match what was rendered on the server. See more info here: https://nextjs.org/docs/messages/react-hydration-error

Open iUnstable0 opened this issue 2 years ago • 1 comments

Describe the bug A clear and concise description of what the bug is. Next.JS Shows this error

Error: Hydration failed because the initial UI does not match what was rendered on the server.

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

This is my code

if (typeof window !== "undefined") {
    loader.init().then(async (monaco) => {
        //set theme and stuff
    })
}

Screenshot 2022-08-03 at 10 51 35 PM

  • OS: Ubuntu Server 20.04.4 LTS
  • Browser: Safari
  • Version: Latest safari version (MacOS Ventura Public Beta 2)

iUnstable0 avatar Aug 03 '22 15:08 iUnstable0

you should use something like this instead of if (typeof window !== "undefined") {. Read more here

suren-atoyan avatar Aug 10 '22 05:08 suren-atoyan