1.1.1 • Published 4 years ago

@react-hooks-custom/use-scroll v1.1.1

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

A React hook for updating components when the scroll position of the window on the y-axis changes.

Quick Start

import useScroll from '@react-hooks-custom/use-scroll'

const Component = (props) => {
  const { scrollX, scrollY } = useScroll();

  return <div>scroll pos: {scrollX}, {scrollY}</div>
}

API

useScroll () => ScrollType

type ScrollType = {
  scrollX: number;
  scrollY: number;
}

Returns { scrollX, scrollY }

TypeDescription
scrollXnumberThe current scroll position of the window on the x-axis
scrollYnumberThe current scroll position of the window on the y-axis

LICENSE

MIT