luxy.js icon indicating copy to clipboard operation
luxy.js copied to clipboard

Importing issue in react js project

Open saadcrest opened this issue 3 years ago • 1 comments

I cannot use your incredible smooth scrolling library due to errors while importing in react js project. Please guide me to implement this in my project. Screenshot 2023-02-27 172158

saadcrest avatar Feb 27 '23 11:02 saadcrest

It simply says that the window object is not defined and it seems like you are using Next.Js not just React.Js in your project. In Next.Js projects we call the window object a little differently. Next.Js offeres server side rendering, which means that your site runs on the server before running on the client. There is no window object on the server (Node.Js). Therefore, try calling the window object from the useEffect Hook. Refer to this article for better explanation. https://articles.wesionary.team/window-object-in-nextjs-1e505349c6f5

onukwilip avatar Mar 30 '23 18:03 onukwilip