p5-react-renderer icon indicating copy to clipboard operation
p5-react-renderer copied to clipboard

ReferenceError: window is not defined in Next.js

Open noam-elbaz opened this issue 3 years ago • 0 comments

Any suggestion for how to best manage importing a Canvas component without causing errors from Next.js like this: ReferenceError: window is not defined in Next.js.

Currently - I'm doing this:

const CanvasSketch = dynamic(() => import('../components/CanvasSketch'), {
  ssr: false,
})

but if you have better, more reliable solutions, would appreciate it.

noam-elbaz avatar Aug 18 '22 22:08 noam-elbaz