useKey
Listen for a key event.
Syntax
useKey(key, listener, options);
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to listen for. |
listener | (event: KeyEvent) => void | The listener to run. |
options | UseKeyOptions | The options. (options) |
Example
useKey('KeyV', event => {
console.log('V key pressed', event);
});
Available on: Client