Not Parents' Money

    react-on-event-outside

    0.1.1 • Public • Published

    React OnEventOutside

    License npm version Build Status Codacy Badge

    This package lets you listen to events outside of a component

    Installation

    npm i --save react-on-event-outside

    Usage

    OnEventOutside takes an on prop which is an object where the keys are the event type (e.g. click, mousedown, keyup, etc.) and the values are your callbacks.

    import OnEventOutside from 'react-on-event-outside';
     
    class MyComponent extends Component {
      onClick(event) {
        console.log('Somewhere else was clicked!', event);
      }
     
      render() {
        return (
          <OnEventOutside on={{
              click: this.onClick
          }}>
            Don't click me, click somewhere else
          </OnEventOutside>
        );
      }
    }

    Keywords

    none

    Install

    npm i react-on-event-outside

    DownloadsWeekly Downloads

    0

    Version

    0.1.1

    License

    Apache-2.0

    Unpacked Size

    472 kB

    Total Files

    14

    Last publish

    Collaborators

    • sam.boylett