name | route | order |
---|---|---|
Docs |
/ |
1 |
use-key-capture is a custom hook which will let us not to worry about the key-press event. Just plugin in use-key-capture hook to the target we want to listen for key press event or by default it can listen for key-press event globally.
npm
npm i use-key-capture
yarn
yarn add use-key-capture
import useKey from 'use-key-capture';
...
const { keyData, resetKeyData, getTargetProps } = useKey();
Property name | Description |
---|---|
keyData | gives pressed key details |
resetKeyData | resets the pressed key details |
Property name | Description |
---|---|
getTargetProps | gives the required props to target element |