Tracks scroll position and deltas.
The callback to execute on scroll.
Optional
Configuration options (container, timeout).
This hook listens to scroll events on the window or a specified container. It debounces the callback to improve performance.
useScrollPosition(({ y, delta }) => { console.log("Scrolled to", y, "Delta", delta.y);}, { timeout: 100 }); Copy
useScrollPosition(({ y, delta }) => { console.log("Scrolled to", y, "Delta", delta.y);}, { timeout: 100 });
Tracks scroll position and deltas.