@uplift-ltd/use-on-page-scroll
v2.0.0
Published
use-on-page-scroll
Downloads
11
Readme
@uplift-ltd/use-on-page-scroll
Installation
npm i --save @uplift-ltd/use-on-page-scroll
API
useOnPageScroll
Hook to handle scroll up/down events. Returns current and previous y position. Cleans up after itself.
import { useOnPageScroll } from "@uplift-ltd/use-on-page-scroll";
useOnPageScroll({
onScrollUp: ([newYPosition, lastYPosition]) => {
console.log(newYPosition, lastYPosition);
},
onScrollDown: ([newYPosition, lastYPosition]) => {
console.log(newYPosition, lastYPosition);
},
});