Skip to content

useKeyPress ​

Category
Sensors

Hook that listens for key press events

typescript
import { useKeyPress } from '@siberiacancode/reactuse';

Usage ​

typescript
const isKeyPressed = useKeyPress('a');

Demo ​

Api ​

Parameters

NameTypeDefaultNote
keyUseKeyPressKey-The key or keys to listen for
options.target?UseEventListenerTargetwindowThe target to attach the event listeners to

Contributors ​

Source • Demo