react-hotkeys: [BUG] Functional component hook state does not update without refocus
Describe the bug
See codesandbox to reproduce: https://codesandbox.io/embed/ecstatic-https-04p9f
Functional component hook state does not update inside of hotKeys bound handler without unfocus and refocus, even when using allowChanges.
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc) HotKeys
Expected behavior The value coming from the handler function should always be the latest state value
Platform (please complete the following information):
- Version of react-hotkeys: 2.0.0-pre7
- Browser: chrome
- OS: MacOS
Are you willing and able to create a PR request to fix this issue? I am. Do you have details about your development workflow? For instance, is there a simple watch script that I can use while developing. most of the instructions I saw were with regards to packaging the production bundle.
APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================
Include the smallest log that includes your issue: I think the codesandbox should make the issue pretty clear, but I’m happy to add this if it would help.
What Configuration options are you using? None
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (11 by maintainers)
That’s fantastic to hear it solved your problems. 😄
A small reminder that if
react-hotkeysdelivers value to you, there are ways of supporting its continued development.No problem, it’s all appreciated. Thanks!