useScroll - Custom React Hook
A custom React Hook to get the vertical scroll of the window. Useful for conditionally rendering elements at fixed scroll points like Sticky Menus or Notifications.
Install
$ npm install react-use-scroll
Usage
; const scroll = ; console; //Stateful scroll value i.e. 0
Another example
; const App = { const scroll = ; return <div className='App'> <Navbar /> scroll === 0 && <p>This welcome message or banner disappears once the user scrolls down</p> /* //Rest of the page */ </div> ;};
License
MIT