Skip to content

Commit 25a93f6

Browse files
author
James
committed
feat: add useScrolling docs
1 parent 3355426 commit 25a93f6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/useScrolling.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# `useScrolling`
2+
3+
React sensor hook that keeps track of whether the user is scrolling or not.
4+
5+
## Usage
6+
7+
```jsx
8+
import { useScrolling } from "react-use";
9+
10+
const Demo = () => {
11+
const scrollRef = React.useRef(null);
12+
const scrolling = useScrolling(scrollRef);
13+
14+
return (
15+
<div ref={scrollRef}>
16+
{<div>{scrolling ? "Scrolling" : "Not scrolling"}</div>}
17+
</div>
18+
);
19+
};
20+
```
21+
22+
## Reference
23+
24+
```ts
25+
useScrolling(ref: RefObject<HTMLElement>);
26+
```

0 commit comments

Comments
 (0)