react-hotkey-hoc
v0.2.1
Published
a hoc for mousetrap
Downloads
5
Readme
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