emreisik95 / scroll-level

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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);
}

About

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


Languages

Language:JavaScript 100.0%