useKeyDown

Tags:

A React Hook that helps to handle keydown event.

Demo

Try to (long) press Enter to increase the counter.

Source
Key down times:
0
Enter

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

It's derivated from useKeyStroke, see useKeyStroke for more details.

// same as `useKeyStroke(keyFilter, handler, {...options, eventName: 'keydown'})` const stop = useKeyDown(keyFilter, handler, options)
ON THIS PAGE