diff options
| author | Dhravya Shah <[email protected]> | 2025-09-18 20:34:18 -0700 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2025-09-18 21:03:49 -0700 |
| commit | 1fcb56908920da386900abb4ce2383374a625c72 (patch) | |
| tree | 0f9d7f695d4c9b1b85be3950fc869e0061dff3ed /packages/hooks/use-keypress.ts | |
| parent | refetching logic change (diff) | |
| download | archived-supermemory-09-18-formatting.tar.xz archived-supermemory-09-18-formatting.zip | |
formatting09-18-formatting
Diffstat (limited to 'packages/hooks/use-keypress.ts')
| -rw-r--r-- | packages/hooks/use-keypress.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/hooks/use-keypress.ts b/packages/hooks/use-keypress.ts index 42906660..eee23acb 100644 --- a/packages/hooks/use-keypress.ts +++ b/packages/hooks/use-keypress.ts @@ -1,15 +1,15 @@ -import { useEffect } from "react" +import { useEffect } from "react"; export const useKeyPress = (key: string, callback: () => void) => { useEffect(() => { const handler = (e: KeyboardEvent) => { if (e.key === key && e.altKey) { - callback() + callback(); } - } - window.addEventListener("keydown", handler) + }; + window.addEventListener("keydown", handler); return () => { - window.removeEventListener("keydown", handler) - } - }, [key, callback]) -} + window.removeEventListener("keydown", handler); + }; + }, [key, callback]); +}; |