skip to Main Content

Reactjs – Window not defined – Nextjs

I'm getting the error that 'window is not defined'. Kindly assist useEffect(() => { const handleScroll = () => { if(typeof window !== 'undefined') { // detect scroll setActive(window.scrollY > 100); }; // add event listener window.addEventListener('scroll', handleScroll); // clear…

VIEW QUESTION
Back To Top
Search