From 25a93f6a6f6078e63041c494f8ac7c4c293d0e9c Mon Sep 17 00:00:00 2001 From: James Date: Mon, 17 Jun 2019 11:08:43 +0100 Subject: [PATCH] feat: add useScrolling docs --- docs/useScrolling.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/useScrolling.md diff --git a/docs/useScrolling.md b/docs/useScrolling.md new file mode 100644 index 0000000000..346da07c0b --- /dev/null +++ b/docs/useScrolling.md @@ -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 ( +
+ {
{scrolling ? "Scrolling" : "Not scrolling"}
} +
+ ); +}; +``` + +## Reference + +```ts +useScrolling(ref: RefObject); +```