microsoft / redux-dynamic-modules

Modularize Redux by dynamically loading reducers and middlewares.
https://redux-dynamic-modules.js.org
MIT License
1.07k stars 116 forks source link

Merge some reducers or another way adding some reducers #110

Open RavilM opened 4 years ago

RavilM commented 4 years ago

Hello! My store: transition: { bus: { .... } } I have a situation where I need to add new reducer for store with the same “transition” key using another module: transition: { bus: { .... }, train: { .... } }

My code first module:

export function getBusModule() {
    return {
        id: 'bus',
        reducerMap: {
            transition: reducerBus
        },
    };
}

Code second module:

export function getTrainModule() {
    return {
        id: 'train',
        reducerMap: {
            transition: reducerTrain
        },
    };
}

How can i do it?

I try did so:

export function getTrainModule() {
    return {
        id: 'train',
        reducerMap: {
            transition: {
                train: reducerTrain
            }
        },
    };
}

But i had ts error: image