<hr>
<div align="center">
  <h1 align="center">
    useScroll()
  </h1>
</div>

<p align="center">
  <a href="https://bundlephobia.com/result?p=@react-hooks-custom/use-scroll">
    <img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/@react-hooks-custom/use-scroll?style=for-the-badge&labelColor=24292e">
  </a>
  <a aria-label="Types" href="https://www.npmjs.com/package/@react-hooks-custom/use-scroll">
    <img alt="Types" src="https://img.shields.io/npm/types/@react-hooks-custom/use-scroll?style=for-the-badge&labelColor=24292e">
  </a>
  <a aria-label="NPM version" href="https://www.npmjs.com/package/@react-hooks-custom/use-scroll">
    <img alt="NPM Version" src="https://img.shields.io/npm/v/@react-hooks-custom/use-scroll?style=for-the-badge&labelColor=24292e">
  </a>
</p>

<pre align="center">npm i @react-hooks-custom/use-scroll</pre>
<hr>

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 }**

|| Type | Description
---|---|---
scrollX | number | The current scroll position of the window on the x-axis
scrollY | number | The current scroll position of the window on the y-axis

# LICENSE

MIT
