From d164d3d4fd3ccd06e848fa01b94b07326dbccb76 Mon Sep 17 00:00:00 2001 From: Onizuka-wl Date: Wed, 2 Oct 2024 15:09:10 -0300 Subject: [PATCH] feat: removed scroll to top hook --- src/hooks/ScrollToTop.tsx | 19 ------------------- src/hooks/index.ts | 1 - 2 files changed, 20 deletions(-) delete mode 100644 src/hooks/ScrollToTop.tsx diff --git a/src/hooks/ScrollToTop.tsx b/src/hooks/ScrollToTop.tsx deleted file mode 100644 index 1f720d7..0000000 --- a/src/hooks/ScrollToTop.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useEffect } from 'react'; -import { useRouter } from 'next/router'; - -export function ScrollToTop() { - const router = useRouter(); - - useEffect(() => { - const handleRouteChange = () => { - window.scrollTo(0, 0); - }; - router.events.on('routeChangeComplete', handleRouteChange); - - return () => { - router.events.off('routeChangeComplete', handleRouteChange); - }; - }, [router.events]); - - return null; -} diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 3ffc027..92f170c 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,2 +1 @@ -export * from './ScrollToTop'; export * from './useStateContext';