react-scroll-bottom-hook
v0.6.2
Published
A react hook that focus on scroll bottom.
Downloads
90
Readme
react-scroll-bottom-hook
yarn add react-scroll-bottom-hook
wutdis
when you have legal doc and you want to check if user had scrolled to the bottom, this will solve your problem. Here's how:
import useScrollBottom from 'react-scroll-bottom-hook'
export default function Welcome() {
const [isBottom, scrollRef ] = useScrollBottom()
return (
<div>
{/* Some super long component her with overflow-y: scroll. attach the ref:*/}
<div
style={{overflowY:'scroll'}}
ref={scrollRef}
>
{state.welcome.privacyPolicy.contents}
</div>
{/* The isBottom state is handled from the library. Use this to disable the button. */}
<button disabled={!isBottom}>
Looks Good! I have Read and Agreed to this Privacy Policy.
</button>
</div>
)
}
size
https://bundlephobia.com/[email protected]
license
unlicensed, use it how u want xd