useKeyPressed
Hook | Source Code
useKeyPressed(key: string, handler: KeyEventHandler): void
Registers an event listener that will be invoked continuously while the specified key is pressed.
Parameters
Section titled “Parameters”key: string
Section titled “key: string”The key to listen for.
handler: KeyEventHandler
Section titled “handler: KeyEventHandler”The handler to invoke when the specified key is pressed.