useKeyPress ​
Hook that listens for key press events
typescript
import { useKeyPress } from '@siberiacancode/reactuse';
Usage ​
typescript
const isKeyPressed = useKeyPress('a');
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
key | UseKeyPressKey | - | The key or keys to listen for |
options.target? | UseEventListenerTarget | window | The target to attach the event listeners to |