DEV Community

Discussion on: How to solve "window is not defined" errors in React and Next.js

Collapse
 
polobustillo profile image
PoloBustillo

Nice work
I was struggling a little with adding a function that is not a default export to run with SSR false, maybe this could be helpful for someone:

import dynamic from 'next/dynamic'

const DynamicComponent = dynamic(() =>
import('../components/hello').then((mod) => mod.Hello)
)