react-hotkey-hoc

0.2.1 • Public • Published

react-hotkey-hoc

THIS IS MY HOTKEY HOC. THERE ARE MANY LIKE IT, BUT THIS ONE IS MINE.

Installation

npm i -S react-hotkey-hoc

What's it do

This is a simple little higher-order component (HOC) for using mousetrap with react. You give it a keymap of shortcuts & it bind it to the mousetrap singleton. The, it'll unbind it when the component unmounts. No mixins, no context, no JSX wrappers, no problems.

Usage

Stick it around your component that needs some hot keys

import {hotkey} from 'redux-hotkey-hoc';
@hotkey(keymap)
class App extends Component {
  ...
}

License

MIT

/react-hotkey-hoc/

    Package Sidebar

    Install

    npm i react-hotkey-hoc

    Weekly Downloads

    11

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • mattkrick