TW-Elements icon indicating copy to clipboard operation
TW-Elements copied to clipboard

ReferenceError: document is not defined

Open nonfungible-dev opened this issue 3 years ago • 4 comments

NextJS applications fail to load when attempting to import tw-elements; this is because the document object is not available when using server-side rendering.

This comment seems to imply that the fix will be to wrap all references to document in a check to ensure it's defined.

if(!(typeof document === "undefined")) {
  // Handle document-related logic here
}

nonfungible-dev avatar Jan 18 '22 22:01 nonfungible-dev

Hi, we just have launched bunch of integration tutorials - both with CSR and SSR frameworks. If you have more questions about integration or you still got some problems with particular components, let us know by adding new issue / topic in discussions section (if there are some unclear informations or just want let us know about something).

Next.js integration tutorial.

Trochonovitz avatar Mar 24 '23 11:03 Trochonovitz