What's the recommended pattern for dealing with setting hotkeys dynamically at runtime? #1145
-
I have a situation where I'm trying to set some keyboard shortcuts, based on some data that is fetched hwen a page loads. Because this is a hook, it shouldn't be set conditionally, in a loop, or in a useEffect. What's the recommended way of handling this? Is it to use the Original react-hotkeys extension? Basically my logic is the following:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For anyone finding this in the future, I followed what was done in the second answer here https://stackoverflow.com/questions/62933902/varying-number-of-hooks-for-keyboard-shortcuts (basically, dynamically create some components; and in the definition of the component, it calls |
Beta Was this translation helpful? Give feedback.
For anyone finding this in the future, I followed what was done in the second answer here https://stackoverflow.com/questions/62933902/varying-number-of-hooks-for-keyboard-shortcuts (basically, dynamically create some components; and in the definition of the component, it calls
useHotKeys
)