use-is-scrolled
v0.0.2
Published
A react hook to detect whether a user has already scrolled on a page or entered a page at a lower section.
Downloads
1
Readme
A react hook to detect whether a user has already scrolled on a page or entered a page at a lower section.
I needed a way of detecting whether the user has scrolled. The main idea of how this hook is built was taken from this livestream (starting at about 46:00) done by Max Stoiber.
Usage
Using npm:
npm install use-is-scrolled
Using yarn:
yarn add use-is-scrolled
After installation, in your react component:
import useIsScrolled from "use-is-scrolled"
// from within your react component and receive true or false
const isScrolled = useIsScrolled();