Skip to content

useScrolling

Determines if the user is actively scrolling within the provided element.

Usage

import { useRef } from "react";
import { useScrolling } from "@/hooks/use-scrolling";
const Component = () => {
const ref = useRef<HTMLDivElement>(null);
const scrolling = useScrolling(ref);
return <div ref={ref}>{scrolling ? "Scrolling" : "Not scrolling"}</div>;
};

Installation

Terminal window
npx atmx add hook use-scrolling