useKeyPress

Tags:

A React Hook that helps to handle keypress event.

Demo

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

Source
Key press 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: 'keypress'})` const stop = useKeyPress(keyFilter, handler, options)
ON THIS PAGE