# use-event-callback

> React hook useEventCallback

Latest version **0.1.0** (published 2019-03-13) · ISC license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-03-13 |
| First published | 2019-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | volune |
| Keywords | react, hooks, useEventCallback, useCallback |

## Links

- npm: https://www.npmjs.com/package/use-event-callback
- npm.io page: https://npm.io/package/use-event-callback

## 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

- 0.1.0 (latest) — 2019-03-13

## README

# React hook `useEventCallback`

Aimed to be easier to use than `useCallback` and solve problems raised in [this ticket](https://github.com/facebook/react/issues/14099).

`useEventCallback` doesn't need any dependencies list.
The returned function should not be used during rendering.

### Example

```jsx
import useEventCallback from 'use-event-callback';

const Input = () => {
  const [value, setValue] = useState('');
  const onChange = useEventCallback((event) => {
    setValue(event.target.value);  
  });

  return <input value={value} onChange={onChange} />;
}
```

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