Skip to content

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.

The key to listen for.


The handler to invoke when the specified key is pressed.