# @ervandra/use-setstate

> React Hooks useState and setState, simplified

Latest version **0.0.1** (published 2021-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ervandra/use-setstate
pnpm add @ervandra/use-setstate
yarn add @ervandra/use-setstate
bun add @ervandra/use-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.0.1 |
| Published | 2021-04-14 |
| First published | 2021-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ervandra |
| Maintainers | ervandra |

## Links

- npm: https://www.npmjs.com/package/@ervandra/use-setstate
- Repository: https://github.com/ervandra/use-setstate
- Homepage: https://github.com/ervandra/use-setstate#readme
- Issues: https://github.com/ervandra/use-setstate/issues
- npm.io page: https://npm.io/package/@ervandra/use-setstate

## Recent versions

- 0.0.1 (latest) — 2021-04-14

## README

# use-setstate

> React hook to useState and setState easily.

## Install

```bash
npm install --save @ervandra/use-setstate
```

## Usage

```tsx
import * as React from 'react'

import { useSetState } from '@ervandra/use-setstate'

const Component = () => {
  const { useState, setState } = useSetState();
  const initialState = {
    isOpen: false,
    isLoading: true
  }
  const state = useState(initialState);
  const { isOpen, isLoading } = state;

  React.useEffect(() => {
    window.setTimeout(() => {
      setState({isOpen: true, isLoading: false})
    }, 1000);
  }, [])

  if(isLoading) return <p>Loading..</p>;

  return (
    <div>
      {isOpen && (
        <p>Is Open</p>
      )}
    </div>
  )
}
```

MIT © [ervandra](https://github.com/ervandra)

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