Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 876 Bytes

README.md

File metadata and controls

31 lines (25 loc) · 876 Bytes

Flat Combine Reducers

A Redux reducer that merges the provided reducers. A combination of combineReducers from redux and reduceReducers from reduce-reducers.

const reducer = flatCombineReducers(
    aReducer,
    bReducer,
    {
        c: cReducer,
        d: dReducer,
    },
);

Will yield a reducer which merges the state from aReducer and bReducer without nesting, together with the state from cReducer under the c key, and dReducer under the d key.

I.e., the type of reducer will be

Reducer<
    StateFromReducer<aReducer> & StateFromReducer<bReducer> & { c: StateFromReducer<cReducer>, d: StateFromReducer<dReducer> },
    Action
>

Additionally, a big difference to reduce-reducers is that the state for the reducers isn't required to be the same, but rather the states from all reducers is merged