Hooks
useWindowScroll

Import this in your client-side component

MyComponent.tsx
import { useWindowScroll } from "react-amazing-hooks";

API

ApiDescriptionTypeReturn TypeExample
useWindowScrollA hook to track the current window scroll position.voidScrollPositionconst { x, y, percentageX, percentageY } = useWindowScroll();

Check the 'Example' tab above the table for an exhaustive example. *