gutiguy / react-spring-3d-carousel

A 3D Carousel component for images built with React and utilizing react-spring for controlling slide transitions.
MIT License
102 stars 50 forks source link

Shows Window is not Defined #48

Open Kingshuk3006 opened 2 years ago

Kingshuk3006 commented 2 years ago

image Though i have writen similar code as demo image..its keeps showing me window is not defined.

sparshsharma2510 commented 2 years ago

@Kingshuk3006 I think you are using some framework like NextJS which renders on the server side first. And because of this it throws such type of error because window is not defined on server side.

what you can do is Create a separate component file where you export this carousel component. and then in the main Hero file use this import dynamic from 'next/dynamic; const Carousel = dynamic( () => import("./path_to_the_carousel_file/Carousel"), { ssr: false, } );