RE

React Hotkeys Hook

react-hotkeys-hook

React hook for handling keyboard shortcuts

Hooks
react
hook
hooks
component
hotkey
shortcut
keyboard
shortcuts
keypress
hotkeys
Stars
3.5k
Weekly
0
Open issues
42
Bundle
~60 kB

Installation

npm install react-hotkeys-hook

Code example

import { useHotkeysHook } from "react-hotkeys-hook";

export function Example() {
  const value = useHotkeysHook();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by Johannes Klauss
  • 0 weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 42 open issues on GitHub

FAQs

Alternatives & similar libraries