diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:09:13 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:26:17 +0100 |
| commit | 36baf3e5725aeae00d81d3a082b3c04074e09f8e (patch) | |
| tree | 34069dc40f7cd45707e8cea0a8993e94841af778 /src/utils/hooks/use-route-change.tsx | |
| parent | c826ad66df066b90b09009f2f4b83b56d018436e (diff) | |
refactor(hooks): replace useRouteChange with useOnRouteChange hook
* handle both event start and event complete
* clean the effect
* add tests
Diffstat (limited to 'src/utils/hooks/use-route-change.tsx')
| -rw-r--r-- | src/utils/hooks/use-route-change.tsx | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/utils/hooks/use-route-change.tsx b/src/utils/hooks/use-route-change.tsx deleted file mode 100644 index 2eff6e9..0000000 --- a/src/utils/hooks/use-route-change.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { useRouter } from 'next/router'; -import { useEffect } from 'react'; - -export const useRouteChange = (callback: () => void) => { - const { events } = useRouter(); - - useEffect(() => { - events.on('routeChangeStart', callback); - }, [events, callback]); -}; |
