React OnEventOutside
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'; { console; } { return <OnEventOutside => click me click somewhere else </OnEventOutside> ; }