react-hook-scrolltop
React Hook for detecting if you're scrolled to the top of the window.
Install
npm install react-hook-scrolltop
Usage
Returns true
when at the top of the page, false
when the user scrolls away.
const Header = { const isTopOfPage = ; return <header style= backgroundColor: isTopOfPage ? 'transparent' : 'white' > ... </header> ;};