@react-utilities/vertical-scroll-distance-detector
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

@react-utilities/vertical-scroll-distance-detector 🏎💨

Typed with TypeScript npm version

Detects the distance that an element has been scrolled with React context.


Install

pnpm install @react-utilities/vertical-scroll-distance-detector

Usage

import React from 'react'
import { 
  VerticalScrollDistanceConsumer, 
  VerticalScrollDistanceProvider,
} from '@react-utilities/vertical-scroll-distance-detector'

function App() {
  return (
    <div className="App">
      <h1>React Context Scroll Distance Detector</h1>
      <VerticalScrollDistanceProvider>
        <VerticalScrollDistanceConsumer>
          {({ verticalScrollDistance }) => (
            <div className="scroll-tracker">
              {verticalScrollDistance}
            </div>
          )}
        </VerticalScrollDistanceConsumer>
      </VerticalScrollDistanceProvider>
    </div>
  )
}

Demo


React Utilities 🏎💨

Utilities for React to simplify development

Everyday components for speeding up React development with little or no extra boilerplate code.


View other React Utilities.

Readme

Keywords

none

Package Sidebar

Install

npm i @react-utilities/vertical-scroll-distance-detector

Weekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

12 kB

Total Files

13

Last publish

Collaborators

  • yowainwright