# concat-reducers

> Concat several reducers into a single reducer without nesting state

Latest version **1.0.2** (published 2018-02-28) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install concat-reducers
pnpm add concat-reducers
yarn add concat-reducers
bun add concat-reducers
```

## 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.2 |
| Published | 2018-02-28 |
| First published | 2017-08-16 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | imjoehaines |
| Maintainers | imjoehaines |

## Links

- npm: https://www.npmjs.com/package/concat-reducers
- Repository: https://github.com/imjoehaines/concat-reducers
- npm.io page: https://npm.io/package/concat-reducers

## Recent versions

- 1.0.2 (latest) — 2018-02-28
- 1.0.1 — 2017-08-16
- 1.0.0 — 2017-08-16

## README

# Concat-Reducers
By default, Redux's combineReducers nests state, which makes it inconvenient to split a large reducer into smaller parts.

Concat-Reducers combines any number of reducers into a single reducer without nesting state, allowing you to decide how to structure state within your own app.

## Installation
```
yarn add concat-reducers
```

## Usage
Instead of Redux's combineReducers, do:
```js
import concatReducers from 'concat-reducers'

import myFirstReducer from './myFirstReducer'
import mySecondReducer from './mySecondReducer'

const reducer = concatReducers(
  myFirstReducer,
  mySecondReducer
)
```


## Further info

State that looks like this with `combineReducers`:

```js
{
  myFirstReducer: {
    id: 1,
    firstReducerForm: {
      name: '',
      email: ''
    }
  },
  mySecondReducer: {
    open: false,
    secondReducerForm: {
      address: '',
      postcode: ''
    }
  }
}
```

would instead look like this with `concatReducers`:

```js
{
  id: 1,
  firstReducerForm: {
    name: '',
    email: ''
  },
  open: false,
  secondReducerForm: {
    address: '',
    postcode: ''
  }
}
```

This simply allows further choice in how to structure state.
Redux's nested state can be recreated if needed, but this also allows for state to be 'flattened' if you wish to do so.

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