Open PhilippMelnikov opened 3 years ago
If we take example from docs you're suggesting, what would the final structure of the store look like?
import { combineReducers} from '@reduxjs/toolkit';
interface ICountersState {
counters: number;
};
interface IOrdersState {
orders: number;
};
interface IMeState {
me: {
counters: ICountersState;
orders: IOrdersState;
}
};
const counters = (state, action) => { // your reducer for counters };
const orders = (state, action) => { // your reducer for orders };
const meModule: IModule<IMeState> = {
id: 'me',
reducerMap: {
me: combineReducers({ counters, orders })
}
};
@PhilippMelnikov give it a try and let me know. I think this should be added to the documentation because it is a very common use case.
I just added support for this via lodash.set paths in this PR: https://github.com/microsoft/redux-dynamic-modules/pull/195
Looking at this repo's activity I do not expect it to be merged (soon) so if you want you can use it immediately with npm gh link: "redux-dynamic-modules": "https://github.com/nkalinov/redux-dynamic-modules.git"
That's what I'm going to do at least.
Hello! Does the library provide support for loading nested reducers? Suppose i have a store structure like this { auth, me: { counters, orders } }
I want to load reducers for orders later. How do I do that?