A Higher Order Component for listening mouse events outside of the component
It's uses callback refs instead of ReactDOM.findDOMNode()
(why).
Usage
Installation
npm install react-event-outside --save
Basic usage:
Component /* listening for default "click" event */Component /* listening for "wheel" and "dblclick" events */
Using ES6:
;; Component { superprops; thishandleEvent = thishandleEvent; } { /* your code */ } { return <div>Nothing here...</div> ); } ShareArea;
Using ES7 decorator:
;; @Component { superprops; thishandleEvent = thishandleEvent; } { /* your code */ } { return <div>Nothing here...</div> ); } ;
Notes
- If
handleEvent
isn't implemented, nothing would happen.
License
MIT