@rehooks/window-scroll-position
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@rehooks/window-scroll-position

React hook for Window scroll position

Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.

You'll need to install react, react-dom, etc at ^16.7.0-alpha.0

Install

yarn add @rehooks/window-scroll-position

Usage

import useWindowScrollPosition from '@rehooks/window-scroll-position'

function MyComponent() {
  // optionally you can pass options, those are default:
  let options = {
    throttle: 100,
  }
  let position = useWindowScrollPosition(options)
  // position == { x: 0, y: 0 }
  return <div />
}

Readme

Keywords

Package Sidebar

Install

npm i @rehooks/window-scroll-position

Weekly Downloads

1,252

Version

1.0.1

License

MIT

Unpacked Size

4.34 kB

Total Files

6

Last publish

Collaborators

  • fouad
  • hanford
  • iamsolankiamit
  • jmoxey
  • mathdroid
  • thejameskyle