react-hotkey-hoc

v0.2.0
a hoc for mousetrap
react shortcuts keyboard

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

Metadata

  • MIT
  • Whatever
  • Matt Krick
  • released 7/19/2016

Downloads

Maintainers