Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.27 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.27 KB

use-scroll-bar

Build Status

Get information of window scrollbar like current position and direction of last scroll.

How to use?

import React from 'react'
import { useScrollbar } from 'use-scroll-bar'


function App() {

	const scrollState = useScrollbar({ delay: 200 })

	retrun (
		<div>
			User has scrolled {scrollState.directionX}
		</div>
	)
}

What this hook return?

{
	directionX: 'left' || 'right',
	directionY: 'up' || 'down',
	scrollX: number,
	scrollY: number
}