Import this in your client-side component
MyComponent.tsx
import { useWindowScroll } from "react-amazing-hooks";
API
Api | Description | Type | Return Type | Example |
---|---|---|---|---|
useWindowScroll | A hook to track the current window scroll position. | void | ScrollPosition | const { x, y, percentageX, percentageY } = useWindowScroll(); |
Check the 'Example' tab above the table for an exhaustive example. *