From 532ebbcacab4340d0928ddd5d8895e315d8e9ea4 Mon Sep 17 00:00:00 2001 From: Nafiu Taiwo Date: Thu, 25 Jul 2024 10:09:39 +0100 Subject: [PATCH] feat: removed cleartimeout clearing --- src/hooks/use-window-width.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hooks/use-window-width.ts b/src/hooks/use-window-width.ts index fb62d5908..ea4115e1c 100644 --- a/src/hooks/use-window-width.ts +++ b/src/hooks/use-window-width.ts @@ -21,7 +21,7 @@ const useWindowWidth = () => { useEffect(() => { if (typeof window !== "undefined") { - const timeout = setTimeout(() => { + setTimeout(() => { setWinWidth(window.innerWidth); }, 500); @@ -31,7 +31,6 @@ const useWindowWidth = () => { window.addEventListener("resize", handleResize); return () => { - clearTimeout(timeout); window.removeEventListener("resize", handleResize); }; }