1.0.2 • Published 5 years ago

@aaronhayes/react-scroll-hook v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

React Scroll Hook

npm (scoped) Bundle Size License

Hook for watching vertical scrolling location when using React Scroll

Install

$ npm install --save @aaronhayes/react-scroll-hook
$ yarn add @aaronhayes/react-scroll-hook

Usage

import { Link, Element , Events, animateScroll as scroll, scrollSpy, scroller } from 'react-scroll'


import useScrollSpy from '@aaronhayes/react-scroll-hook';

const MyScrollWatchingComponent = () => {
    const location = useScrollSpy();
    console.log(location);
    // Location will either be undefined or the current element scrolled to.

    return (
        <div>
            <h1>
                You are currently scrolled to: {location}
            </h1>
        </div>
    )
}

See Also