react-mousetrap
v0.2.0
Published
HOC builder for Mousetrap
Downloads
6,065
Maintainers
Readme
react-mousetrap
React's high order component for Mousetrap integration.
Setup
Yarn install
yarn add react-mousetrap
Example
Create higher order component
import mouseTrap from 'react-mousetrap';
class YourComponent extends React.Component {
/*your implementation */
componentWillMount {
this.props.bindShortcut('right', this._goToNext);
}
_goToNext() {
this.props.unbindShortcut('right');
}
}
export default mouseTrap(BaseComponent);