Hotkey library based for Reactjs
npm install @acrool/react-hotkey
This is a toast message function for React development notifications





^1.0.0 support react >=18.0.0 <20.0.0
- Supports dom onKeyDown
- Supports not repeat onKeyDown
- componentOnMount add listen, componentUnMount remove listen
``bash`
yarn add @acrool/react-hotkey
`tsx
import {generateOnKeydown, HotkeyListener} from '@acrool/react-hotkey';
const Example = () => {
const handleSave = () => {
// white yourr code
}
const handleCancel = () => {
// white yourr code
}
/**
* Save
*/
const handleOnKeyDown = (e) => {
generateOnKeydown('ctrl+enter', handleSave)(e);
generateOnKeydown('escape', handleCancel)(e);
};
return (<>
>
);
};
``
There is also a example that you can play with it:
