Quick Start
Get up and running with keyboard shortcuts in under a minute.
Install
- NPM
- Bun
- Yarn
yarn add react-hotkeys-hook
npm i react-hotkeys-hook
bun i react-hotkeys-hook
Usage
import { useHotkeys } from 'react-hotkeys-hook';
Live Editor
function MyComponent() { const [count, setCount] = useState(0); useHotkeys('a', () => setCount(count => count + 1)); return ( <span>Pressed the 'a' key {count} times.</span> ); }
Result
Loading...
TypeScript support out of the box
react-hotkeys-hook is written in TypeScript — no additional @types package needed.