# barracks-react

> An action dispatcher for unidirectional data flows for React components

Latest version **3.0.1** (published 2017-01-12) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2017-01-12 |
| First published | 2016-09-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Todd Kennedy |
| Maintainers | scripto-llc, toddself |
| Keywords | barracks, choo, react, flux, redux, elm, unidirectional, data |

## Links

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

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^15.4.1
- [barracks](https://npm.io/package/barracks.md) ^9.2.1
- [@types/react](https://npm.io/package/@types/react.md) ^0.14.55

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

- 3.0.1 (latest) — 2017-01-12
- 3.0.0 — 2017-01-12
- 2.1.1 — 2016-12-29
- 2.1.0 — 2016-12-29
- 2.0.1 — 2016-12-28
- 2.0.0 — 2016-12-28
- 1.0.1 — 2016-09-01
- 1.0.0 — 2016-09-01

## README

# barracks-react

An action dispatcher for React that provides for unidirectional dataflows.
Intended to be very small and provide a small amount of cognative overhead in
providing an "actions up, data down" type model for React. Built on top of
[barracks](https://github.com/yoshuawuyts/barracks).

## Usage
```js
const React = require('react')
const ReactDOM = require('react-dom')
const bearact = require('./')

const model = {
  namespace: 'example',
  state: {
    hello: ''
  },
  reducers: {
    setHello: (state, data) => ({hello: data.value})
  }
}

const Main = React.createClass({
  handleChange: function (evt) {
    this.props.send('setHello', {value: evt.target.value})
  },
  render: function () {
    return React.createElement('div', {}, [
      React.createElement('h1', {}, `Hello, ${this.props.model.hello}`),
      React.createElement('br', {}, null),
      React.createElement('input', {value: this.props.model.hello, onChange: (evt) => this.handleChange(evt)}, null)])
  }
})

const main = React.createElement(bearact(Main, model))
const mount = document.createElement('div')
document.body.appendChild(mount)
ReactDOM.render(main, mount)
```

## License
Copyright © 2016 Scripto, licenced under the Apache-2.0 license

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