Browse Source

[beta] fix: cleanup resize listener (#4847)

main
Shanmughapriyan S 2 years ago
committed by GitHub
parent
commit
3a9b0c81e2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      beta/src/components/MDX/Challenges/Navigation.tsx

5
beta/src/components/MDX/Challenges/Navigation.tsx

@ -71,9 +71,10 @@ export function Navigation({
useEffect(() => {
handleResize();
window.addEventListener('resize', debounce(handleResize, 200));
const debouncedHandleResize = debounce(handleResize, 200);
window.addEventListener('resize', debouncedHandleResize);
return () => {
window.removeEventListener('resize', handleResize);
window.removeEventListener('resize', debouncedHandleResize);
};
}, [handleResize]);

Loading…
Cancel
Save