# @feca-hooks/use-scroll

> React Hook to create scroll event faster and easier.

Latest version **1.0.1** (published 2021-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @feca-hooks/use-scroll
pnpm add @feca-hooks/use-scroll
yarn add @feca-hooks/use-scroll
bun add @feca-hooks/use-scroll
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-02-26 |
| First published | 2021-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | pshtony1 |
| Maintainers | pshtony1 |
| Keywords | react, hooks, hook, scroll, coords, x/y |

## Links

- npm: https://www.npmjs.com/package/@feca-hooks/use-scroll
- Repository: https://github.com/pshtony1/custom-hooks
- Homepage: https://github.com/pshtony1/custom-hooks#readme
- Issues: https://github.com/pshtony1/custom-hooks/issues
- npm.io page: https://npm.io/package/@feca-hooks/use-scroll

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^17.0.1
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-02-26
- 1.0.0 — 2021-02-26

## README

# @feca-hooks/use-scroll

React Hook to **create scroll event faster and easier.**

<br />

## How to Install

#### yarn

`yarn add @feca-hooks/use-scroll`

#### npm

`npm i @feca-hooks/use-scroll`

<br />

## Usage

### Code

```
import React from "react";
import useScroll from "@feca-hooks/use-scroll";

function App() {
  const onScroll = () => {
    console.log("Scrolling now.");
  };

  const { scrollX, scrollY } = useScroll(onScroll);

  return <h1>Scroll Position: { scrollX } / { scrollY }</h1>;
}
```

### Arguments

| **Argument** | **Type** | **Description**                                           | **Required** |
| ------------ | -------- | --------------------------------------------------------- | ------------ |
| onScroll     | function | The callback function executed when scroll event happens. | no           |

### Return

| **Return value** | **Type** | **Description**                                                          | **Default value**            |
| ---------------- | -------- | ------------------------------------------------------------------------ | ---------------------------- |
| Coords           | object   | An object containing the x, y coordinates of the current scroll position | `{ scrollX: 0, scrollY: 0 }` |

---
_Source: https://npm.io/package/@feca-hooks/use-scroll · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
