Installation
Note: React 16.8+ is required to use Hooks.
Package Managers
To install the package we use our favorite package manager.
- pnpm
- bun
- npm
- yarn
pnpm add react-hotkeys-hook@4
bun add react-hotkeys-hook@4
npm i react-hotkeys-hook@4 --save
yarn add react-hotkeys-hook@4
ES Module
To use the ES Module we can reference it directly from unpkg.com:
import { useHotkeys } from 'https://unpkg.com/browse/react-hotkeys-hook@3.4.0/dist/react-hotkeys-hook.esm.js'
Direct CommonJS Module
We also have access to a development as well as a minified production bundle for CommonJS:
- Development
- Production
<script src="https://unpkg.com/browse/react-hotkeys-hook@3.4.0/dist/react-hotkeys-hook.cjs.development.js"/>
<script src="https://unpkg.com/browse/react-hotkeys-hook@3.4.0/dist/react-hotkeys-hook.cjs.production.min.js"/>
Now we are good to go to use the hook.