# use-throttled-callback

> The throttled version of React's useCallback.

Latest version **2.0.0** (published 2020-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-throttled-callback
pnpm add use-throttled-callback
yarn add use-throttled-callback
bun add use-throttled-callback
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-06-14 |
| First published | 2019-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Valerio Belli |
| Maintainers | valerio.belli |

## Links

- npm: https://www.npmjs.com/package/use-throttled-callback
- Repository: https://github.com/DrugoLebowski/use-throttled-callback
- npm.io page: https://npm.io/package/use-throttled-callback

## Dependencies (3)

- [@types/jest](https://npm.io/package/@types/jest.md) ^24.0.18
- [@types/react](https://npm.io/package/@types/react.md) ^16.9.36
- [@types/react-dom](https://npm.io/package/@types/react-dom.md) ^16.9.8

## Recent versions

- 2.0.0 (latest) — 2020-06-14
- 1.0.1 — 2019-08-28

## README

useThrottledCallback
====================

Prerequisites
-------------
NPM

`npm install react react-dom`

Yarn

`yarn add react react-dom`

Install
-------
With npm

`npm install use-throttled-callback`

With Yarn

`yarn add use-throttled-callback`

Usage
-----

```typescript
import React, { ChangeEvent, useState } from 'react'
import { useThrottledCallback } from 'use-throttled-callback'

const FuncComp = () => {
  const [text, setText] = useState('')

  const { flush, result: handleThrottledChange } = useThrottledCallback(
    (e: ChangeEvent<HTMLInputElement>) => {
      setText(e.target.value)
    },
    10000,
    [],
  )

  return (
    <div>
      <button onClick={flush}>Click me to reset the callback throttling!</button>

      <input onChange={handleThrottledChange} />

      {text}
    </div>
  )
}
```

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