From db27e1f692b12e4eb5ad4316cf4e1c2dcd892d98 Mon Sep 17 00:00:00 2001 From: Joseph Mathew Date: Thu, 21 Nov 2024 09:16:41 +0530 Subject: [PATCH] Fixed stale state issue in callbacks (#32) --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 15b6385..cb89552 100644 --- a/src/index.js +++ b/src/index.js @@ -31,7 +31,7 @@ const useHotKeys = (hotkey, handler, userConfig, externalDocument) => { const mousetrapInstance = bindHotKey({ mode: memoizedConfig.mode, hotkey: convertedHotkey, - handler: handlerRef.current, + handler: (...args) => handlerRef.current(...args), ref, externalDocument, });