@yarigo/redux-dynamic-modules-saga
v5.2.3
Published
Saga Extension for redux-dynamic-modules (fork https://github.com/microsoft/redux-dynamic-modules)
Downloads
4
Maintainers
Readme
Install
Run
npm install @yarigo/redux-dynamic-modules-saga
or
yarn add @yarigo/redux-dynamic-modules-saga
Usage
- Create a module with the following format
export function getUsersModule(): ISagaModule<IUserState> {
return {
id: "users",
reducerMap: {
users: usersReducer,
},
sagas: [userSagas],
// Actions to fire when this module is added/removed
// initialActions: [],
// finalActions: [],
};
}
- Create a
ModuleStore
import { createStore, IModuleStore } from "redux-dynamic-modules";
import { getSagaExtension } from "redux-dynamic-modules-saga";
import { getUsersModule } from "./usersModule";
const store: IModuleStore<IState> = createStore(
{
initialState: {},
enhancers: [],
extensions: [getSagaExtension({} /* saga context */)],
},
getUsersModule()
/* ...any additional modules */
);