use-window-scroll-position
React hook to get current scroll position of the window
Table of Contents
Usage
import {useWindowScrollPosition} from 'use-window-scroll-position'
const Nav = () => {
const position = useWindowScrollPosition() // default config: { wait = 100, passive = true }
console.log(position) // {x: ..., y: ...}
return null
}
Install
This project uses node and npm.
$ npm install use-window-scroll-position
$ # OR
$ yarn add use-window-scroll-position
Contribute
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
mit