2.0.5 • Published 6 years ago

combined-reducers-ngrx v2.0.5

Weekly downloads
1,215
License
ISC
Repository
github
Last release
6 years ago

COMBINED REDUCER NGRX

Its very usefull while using multiple reducers to change/update a single state. Inorder to build a larger reducer file, split the code into defferent reducer files as per the logic and combine them into a single reducer.

Reference : https://github.com/neoito-hub/combined-reducers-ngrx

Usage

Create a inde.reducer file.

import { runCombinedReducer } from 'combined-reducers-ngrx

Get the reducer functions into an array

let combinedReducer = [reducer1, reducer2, reducer3, etc]

let the library get the current state, action and the array of reducers:

return runCombinedReducer(state, action, combinedReducer)

the code must be like the below, In the index.reducer.ts

import { reducer1 } from '..';
import { reducer2 } from '..';

const initialState: any = {};
export function CombinedReducer(
state = initialState,
action: any
): any {
let combinedReducer = [reducer1, reducer2, reducer3];

    return runCombinedReducer(state, action, combinedReducer);

}

```

## _Installation_

`npm i combined-reducers-ngrx`

Good luck!
2.0.5

6 years ago

2.0.4

6 years ago

2.0.2

6 years ago

1.0.14

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago