# react-miniflow

> A simple library for unidirectional dataflow in React and React Native.

Latest version **1.0.1** (published 2015-10-07) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2015-10-07 |
| First published | 2015-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Emil Mork |
| Maintainers | emilmork |
| Keywords | data, event, action, store, dataflow, architecture, flux, react |

## Links

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

## Dependencies (4)

- [util](https://npm.io/package/util.md) ^0.10.3
- [react](https://npm.io/package/react.md) ^0.13.3
- [events](https://npm.io/package/events.md) ^1.1.0
- [immutable](https://npm.io/package/immutable.md) ^3.7.5

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-10-07
- 1.0.0 — 2015-10-07
- 0.1.9 — 2015-10-01
- 0.1.8 — 2015-10-01
- 0.1.7 — 2015-10-01
- 0.1.6 — 2015-10-01
- 0.1.5 — 2015-10-01
- 0.1.3 — 2015-10-01
- 0.1.2 — 2015-10-01
- 0.1.1 — 2015-10-01
- 0.1.0 — 2015-10-01

## README

#### Install

```sh
$ npm install react-miniflow
```

#### Usage

```javascript

var React = require('react');
import { State, Enhance } from 'react-miniflow';

State.init({count: 0});

// Enhance component and listen for count updates
var Component = Enhance(
  class extends React.Component {
    render() {
      return <h2>{ this.props.count }</h2>
    }
},['count']);

// Update state
setInterval(() => {
  State.set('count', State.get('count')+1);
},1000)

```


Example with multiple listeners and custom setState() handler

```javascript
State.init({count: 0, name: 'Odjob'});

// Enhance component and listen for count updates
var Component = Enhance(
  class extends React.Component {
    render() {
      return <div>
        <h2>{ this.props.count }</h2>
        <h2>{ this.props.name }</h2>
      </div>
    }
},['count',{event: 'name', handler: (name) => {
  return `Hello Mr.${name}`
}}]);

setInterval(() => {
  State.set('count', (State.get('count')+1);
},1000)

// Update state
setTimeout(() => {
  State.set('name', 'Bond');
},1000);
```

### State Methods

* ### State.set(type, data) > this.props.[type] -> {id: type, value: data}

* ### State.get(type) -> {id: type, value: data}

* ### State.init(structure) -> Set initial structure

* ### State.fire(event, data) -> emit event
---
#### Changelog:
##### 1.0.0 - Api changes - Change datastructure to return only data not id and value

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