# react-hook-setstate

> Use setState in react hook like you would use in react classes

Latest version **0.1.1** (published 2021-09-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-hook-setstate
pnpm add react-hook-setstate
yarn add react-hook-setstate
bun add react-hook-setstate
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-09-18 |
| First published | 2019-05-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Wellington Viveiro |
| Maintainers | wviveiro |

## Links

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

## Recent versions

- 0.1.1 (latest) — 2021-09-18
- 0.1.0 — 2021-09-18
- 0.0.3 — 2019-05-30
- 0.0.2 — 2019-05-30

## README

# react-hook-setstate
Use setState function in react hooks as you would use in react classes.

## Install
```
npm install -S react-hook-setstate
```

## Usage
```javascript
import createState from 'react-hook-setstate';

const MyComponent = () => {
  const [state, setState] = createState({counter1: 0, counter2: 0});
  
  return (
    <div>
        Counter 1: {state.counter1}<br />
        <button onClick={() => setState({counter1: state.counter1 + 1})}> 
            Add
        </button>
        <hr />
        Counter 2: {state.counter2}<br />
        <button onClick={() => setState({counter2: state.counter2 + 1})}> 
            Add
        </button>
    </div>
  );
}
```

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