Installation
Note: React 16.8+ is required to use Hooks.
Yarn & NPM
To install the package we use our favorite package manager.
- Yarn
- NPM
yarn add react-hotkeys-hook
npm i react-hotkeys-hook --save
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.