Open warpdesign opened 5 years ago
I have a component that is reused twice inside my app:
... renderHotkeys() { return <Hotkeys> <Hotkey global={true} combo="meta + c" label="Copy selected files to clipboard" onKeyDown={this.onCopy} /> } ...
Since renderHotkeys() is called twice, the hotkey is registered twice and appears twice in the hotkeys dialog
This is working as expected, but since the component is mounted twice, the hotkeys appear also twice in the hotkey dialog.
How could I avoid that?
Moving the hotkeys up to the parent component is not really an option since it means moving all the logic inside the parent too.
this is a limitation of the current API. there's no easy workaround at this time. pulling the hotkey up will be your best bet.
Environment
Question
I have a component that is reused twice inside my app:
Since renderHotkeys() is called twice, the hotkey is registered twice and appears twice in the hotkeys dialog
This is working as expected, but since the component is mounted twice, the hotkeys appear also twice in the hotkey dialog.
How could I avoid that?
Moving the hotkeys up to the parent component is not really an option since it means moving all the logic inside the parent too.