react-mousetrap

0.2.0 • Public • Published

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);

Package Sidebar

Install

npm i react-mousetrap

Weekly Downloads

1,763

Version

0.2.0

License

SEE LICENSE IN LICENSE

Last publish

Collaborators

  • alvinsj