mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
21 lines
285 B
Markdown
21 lines
285 B
Markdown
# `useWindowScroll`
|
|
|
|
React sensor hook that re-renders on window scroll.
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useWindowScroll} from 'react-use';
|
|
|
|
const Demo = () => {
|
|
const {x, y} = useWindowScroll();
|
|
|
|
return (
|
|
<div>
|
|
<div>x: {x}</div>
|
|
<div>y: {y}</div>
|
|
</div>
|
|
);
|
|
};
|
|
```
|