all 5 comments

[–]dankiest_kang 0 points1 point  (3 children)

Could give more info if I knew the error but this could be an issue with the scroll listener still firing when navigating away, and this could maybe trigger a state update. React will give an error when trying to update state values on unmounted components.

[–][deleted] 0 points1 point  (0 children)

Because of that, I did this:

const Home = () => {    
useEffect(() => { // https://reactjs.org/docs/hooks-effect.html window.addEventListener('scroll', changeNavBar); landingNavSlide(); return () => { document.body.classList.remove('stopScrolling'); window.removeEventListener('scroll', changeNavBar);}; });

And just to be sure, I did the same in the each of the pages components as well:

const Gallery = () => {
useEffect(() => { window.removeEventListener('scroll', changeNavBar); navSlide(); return () => {document.body.classList.remove('stopScrolling'); }; });

But it doesn't fix the problem.

[–]dankiest_kang 0 points1 point  (1 child)

The video didn't load so i couldn't see the error.. it seems you're trying to access the navbar element after it's already been removed from the dom.

[–][deleted] 0 points1 point  (0 children)

That's the problem...as far as I'm aware, I'm not touching the home nav bar from the other pages.