@react-utilities/vertical-scroll-distance-detector
v0.0.4
Published
Detects vertical scroll distance using React Context
Downloads
4
Readme
@react-utilities/vertical-scroll-distance-detector 🏎💨
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.