How to use react-use-scrollspy - 1 common examples

To help you get started, we’ve selected a few react-use-scrollspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Purii / react-use-scrollspy / example / src / App.js View on Github external
const App = () => {
  const sectionRefs = [useRef(null), useRef(null), useRef(null)];

  const activeSection = useScrollSpy({
    sectionElementRefs: sectionRefs,
    offsetPx: -80,
  });

  return (
    <div>
      <header>
        <img alt="logo" src="{logo}">
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        </header></div>

react-use-scrollspy

Flexible React Hook to automatically update navigation based on scroll position

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Popular react-use-scrollspy functions

Similar packages