From 36baf3e5725aeae00d81d3a082b3c04074e09f8e Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 15 Nov 2023 17:09:13 +0100
Subject: refactor(hooks): replace useRouteChange with useOnRouteChange hook

* handle both event start and event complete
* clean the effect
* add tests
---
 src/utils/hooks/use-route-change.tsx | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 src/utils/hooks/use-route-change.tsx

(limited to 'src/utils/hooks/use-route-change.tsx')

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]);
-};
-- 
cgit v1.2.3

