diff --git a/beta/src/components/MDX/Challenges/Navigation.tsx b/beta/src/components/MDX/Challenges/Navigation.tsx index 51cf5cb52..e448828cf 100644 --- a/beta/src/components/MDX/Challenges/Navigation.tsx +++ b/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]);