-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James
committed
Jun 17, 2019
1 parent
3355426
commit 25a93f6
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# `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>); | ||
``` |