# redux-acb

> Action Creator Binder (Service/Helper for Redux Infrastructure)

Latest version **1.4.1** (published 2017-07-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install redux-acb
pnpm add redux-acb
yarn add redux-acb
bun add redux-acb
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2017-07-21 |
| First published | 2017-03-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | artur.basak@instinctools.ru |
| Maintainers | archik408 |
| Keywords | react, redux, actions, action-creators, bound-action-creators, binder |

## Links

- npm: https://www.npmjs.com/package/redux-acb
- Repository: https://github.com/archik408/redux-acb
- Homepage: https://github.com/archik408/redux-acb/blob/master/README.md
- Issues: https://github.com/archik408/redux-acb/issues
- npm.io page: https://npm.io/package/redux-acb

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

- 1.4.1 (latest) — 2017-07-21
- 1.4.0 — 2017-04-11
- 1.3.5 — 2017-03-24
- 1.3.4 — 2017-03-24
- 1.3.3 — 2017-03-16
- 1.2.3 — 2017-03-16
- 1.2.2 — 2017-03-16
- 1.1.2 — 2017-03-16
- 1.0.2 — 2017-03-16
- 1.0.1 — 2017-03-16
- 1.0.0 — 2017-03-16

## README

!!! THIS APPROACH IS DEPRECATED: look at this [react-archux-example](https://github.com/archik408/react-archux-example),
check [store](https://github.com/archik408/react-archux-example/blob/master/client/app/src/store/Store.js) and [unidirectional data flow](https://github.com/archik408/react-archux-example/blob/master/client/app/src/store/Dispatcher.js) implementation: 


## Application dispatcher (Service/Helper for Redux Infrastructure)
[![npm version](https://img.shields.io/npm/v/redux-acb.svg?style=flat-square)](https://www.npmjs.com/package/redux-acb)

### Image:

![img](./media/pic.png "schema")

### Interface
This module provide following interface:
```
createAction
boundAction
boundPromise
boundAsync
```

### Async Example:
```javascript
import { buildDispatcher } from 'redux-acb';
import store from './store';

const { boundPromise } = buildDispatcher(store);

/**
 * Bound login action creators
 *
 * @param {String} username - User name
 * @param {String} password - User password
 *
 * @returns {Function} Binder
*/
export function boundLogin(username, password) {
  return boundPromise(
    login,
    'LOGIN',
    (state) => state.Auth.loading,
    [username, password]
  );
}

/**
 * Bound logout action creators
 *
 * @returns {Function} Binder
 */
export function boundLogout() {
  return boundPromise(
    logout,
    'LOGOUT',
    (state) => state.Auth.loading
  );
}
```

### Pure Example:
```javascript
import { buildDispatcher } from 'redux-acb';
import store from './store';

const { boundAction } = buildDispatcher(store);
/**
 * Bound project information modal toggle action creator
 *
 * @returns {Function} Binder
 */
export function boundToggleProjectInformationModal() {
  return boundAction('TOGGLE_PROJECT_INFORMATION_MODAL');
}
```

### Reducer
```javascript

...

export function authReducer(state = initialState, action) {
  switch (action.type) {
    // ********************* LOGIN ******************************
    case 'LOGIN_PENDING':
        // TODO return new state
    case 'LOGIN_SUCCESS':
        // TODO return new state
    case 'LOGIN_FAIL':
        // TODO return new state
    case 'LOGOUT_PENDING':
      // TODO return new state
    case 'LOGOUT_SUCCESS':
      // TODO return new state
    case 'LOGOUT_FAIL':
      // TODO return new state
    default:
      return state;
  }
}

...

```

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