Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
11 replies
~Abhinav

window is not defined inside Suspense boundary.

I am loading a component with React.lazy() that uses window.location.origin inside <Suspense> boundary like this.

const LinkCreateForm = React.lazy(() => import("../components/LinkCreateForm"));

<React.Suspense fallback={<div>loading...</div>}><LinkCreateForm /></React.Suspense>

Its showing window is not defined on initial load. What could be the reason? Any help is appreciated.
image.png
Was this page helpful?