# debounce-hook

> simple debounce onChange hook

Latest version **1.0.0** (published 2018-11-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install debounce-hook
pnpm add debounce-hook
yarn add debounce-hook
bun add debounce-hook
```

## 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.0 |
| Published | 2018-11-13 |
| First published | 2018-11-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 888.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Nudelman |
| Maintainers | nudelx |
| Keywords | react, hook, hooks, compose, javascript |

## Links

- npm: https://www.npmjs.com/package/debounce-hook
- Repository: https://github.com/nudelx/debounce-hook
- Homepage: https://github.com/nudelx/debounce-hook#readme
- Issues: https://github.com/nudelx/debounce-hook/issues
- npm.io page: https://npm.io/package/debounce-hook

## 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.0 (latest) — 2018-11-13

## README

<p align="center">
<img width="600px" height="300px" style="max-width: 100%; margin-right: auto;  margin-left: auto; " src="https://raw.githubusercontent.com/nudelx/debounce-hook/master/img/img1.png" ></p>

# React Debounce Hook

React hook with debounced onChange and after effect call back ( React > 16.7.0 )

`useDebounceHook (defaultValue| <default ''>, debounce: <default 400ms>, afterEffect: < optional callback>)`

You can provide an after effect callback which will be triggered after debounce onInputChange

## Usage

```js
import useDebounceHook from 'debounce-hook'

const Input = ({
  id,
  defaultValue = '',
  debounce = 400,
  className,
  placeholder,
  name
}) => {
  const { value, onInputChange } = useDebounceHook(defaultValue, debounce, () =>
    console.log('UPDATE')
  )
  return (
    <div className={className}>
      <label htmlFor={id}>{name}</label>
      <input
        placeholder={placeholder}
        name={name}
        value={value}
        id={id}
        onChange={e => onInputChange(e.target.value)}
      />
    </div>
  )
}
```

## Demo

![demo](https://raw.githubusercontent.com/nudelx/debounce-hook/master/img/demo.gif)

## Installation

```
 npm i debounce-hook
```

or

```
 yarn add debounce-hook
```

---

Made with ♥ by nudelx

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