Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS ReferenceError: self is not defined #68

Closed
DarkPhoenix2704 opened this issue Jan 21, 2023 · 2 comments
Closed

NextJS ReferenceError: self is not defined #68

DarkPhoenix2704 opened this issue Jan 21, 2023 · 2 comments

Comments

@DarkPhoenix2704
Copy link

ReferenceError: self is not defined

This error happened while generating the page. Any console logs will be displayed in the terminal window.

Throws error in next js

@DarkPhoenix2704
Copy link
Author

Duplicate #66 #67

@ProDanish203
Copy link

In nextjs, you need to dynamically import the component to ensure that the component is not loaded on the server side, bexause nextjs, first runs the code on server side at the first time even after using the 'use client' directive.

The solution is to use dynamic import like this:
import dynamic from "next/dynamic";

const Carousel = dynamic(() => import("react-spring-3d-carousel"), {
ssr: false,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants