Skip to content

useWindowScroll

Tracks the current window scroll position.

Usage

import { useWindowScroll } from "@/hooks/browser/use-window-scroll";
const Component = () => {
const { x, y } = useWindowScroll();
return (
<div>
<p>Window Scroll X: {x}</p>
<p>Window Scroll Y: {y}</p>
</div>
);
};

Installation

Terminal window
npx atmx add hook use-window-scroll