Wheel React
Easy integration!!! Easily detect mouse wheel and trackpad movement direction, even when there is no scrolling overflow.
Usage
- Install the npm package:
npm install --save wheel-react
- Import it:
;
- Config mouse-wheel/trackpad events ('left', 'right', 'up', 'down'), at least one of them, in your component constructor, or in render function:
WheelReact;
- Integrate with your React component:
<YourComponent ...WheelReactevents />
- Put the following line in componentWillUnmount function:
WheelReact;
Example
;; { superprops; thisstate = content: 'Move your mouse mouse wheel or trackpad or try to scroll here!' ; WheelReact; } { let styles = height: '400px' fontSize: '34px' textAlign: 'center' ; return <div ...WheelReactevents tabIndex="1" style=styles> thisstatecontent </div> ; } ;