# react-unstated

> Redux-like connect function for unstated.

Latest version **0.0.3** (published 2019-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-unstated
pnpm add react-unstated
yarn add react-unstated
bun add react-unstated
```

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-02-26 |
| First published | 2019-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | SDmaN |
| Maintainers | sdman |
| Keywords | redux, unstated, connect, react |

## Links

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

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.8.3
- [unstated](https://npm.io/package/unstated.md) ^2.1.1
- [@types/react](https://npm.io/package/@types/react.md) ^16.8.4

## 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.0.3 (latest) — 2019-02-26
- 0.0.2 — 2019-02-26

## README

# React-unstated

Redux-like `connect` for `unstated`.

## Installation
```sh
npm install --save react-unstated
```

## Usage
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { Container, Provider } from 'unstated';
import { connect } from 'react-unstated';

class CounterContainer extends Container {
  state = {
    count: 0
  }

  increase = () => {
    this.setState({
      count: this.state.count + 1
    });
  }
}

const Counter = ({ n, inc }) => (
  <div>
    <div>{n}</div>
    <div>
      <button onClick={inc}>Increase</button>
    </div>
  </div>
);

const EnchancedCounter = connect(Counter, CounterContainer, (c) => {
  return {
    n: c.state.count,
    inc: c.increase
  };
});

ReactDOM.render((
  <Provider>
    <EnchancedCounter />
  </Provider>
), document.getElementById('root'));
```

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