mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
Remove event after unmount
This commit is contained in:
@ -23,6 +23,7 @@ const MainLayout = ({ children }: Props) => {
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, [handleScroll]);
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user