A React hook for window on scroll event
npm install @rooks/use-on-window-scroll```
npm install rooks
or
``
yarn add rooks
Rooks is completely treeshakeable and if you use only 1 of the 50+ hooks in the package, only that hook will be bundled with your code. Your bundle will only contain the hooks that you need. Cheers!
!Build Status   
``
npm install --save @rooks/use-on-window-scroll
`javascript`
import useOnWindowScroll from "@rooks/use-on-window-scroll"
`jsx
function Demo() {
useOnWindowScroll(() => console.log("window scrolled"))
return
Hello world
render(
``
| Arguments | Type | Description | Default value |
| --------- | -------- | ----------------------------------------------- | ------------- |
| callback | function | Callback function which needs to run on unmount | undefined |
| when | boolean | When the event handler should be active | true |