react-mousetrap

HOC builder for Mousetrap

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-mousetrap
3140.2.07 years ago9 years agoMinified + gzip package size for react-mousetrap in KB

Readme

react-mousetrap Build Status npm version
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);