|
Download react-use/docs/useScrolling.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/docs/useScrolling.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-use/docs/useScrolling.md
-
curl -L -o useScrolling.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-use/docs/useScrolling.md
453 Bytes
| # `useScrolling` | |
| React sensor hook that keeps track of whether the user is scrolling or not. | |
| ## Usage | |
| ```jsx | |
| import { useScrolling } from "react-use"; | |
| const Demo = () => { | |
| const scrollRef = React.useRef(null); | |
| const scrolling = useScrolling(scrollRef); | |
| return ( | |
| <div ref={scrollRef}> | |
| {<div>{scrolling ? "Scrolling" : "Not scrolling"}</div>} | |
| </div> | |
| ); | |
| }; | |
| ``` | |
| ## Reference | |
| ```ts | |
| useScrolling(ref: RefObject<HTMLElement>); | |
| ``` | |