npm.io
1.0.4 • Published 4 years ago

react-scroll-level

Licence
—
Version
1.0.4
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Stars
1

useScrollLevel - a custom React hook

A lightweight (1 kB) package to easily track scroll percentage in React.js

Install

npm install react-scroll-level

Example

import React from 'react'
import { useScrollLevel } from 'react-scroll-level'

function App() {
  const { scrollHeight, scrollWidth } = useScrollLevel();
  console.log('scrollHeight:', scrollHeight); 
  console.log('scrollWidth:', scrollWidth);
}

Keywords