id-redux-modules
Groups your Redux reducers and routes into modules so you can easily compose them.
Installation
npm install --save id-redux-modules
Usage
const Module = Module const myModule = name: "MyModule" store: myStore
Module
Represents a composable collection of redux parts.
Kind: global class
- Module
- new Module(options)
- .name ⇒
String
- .name ⇒
Undefined
- .store ⇒
String
- .store ⇒
Undefined
- .actions ⇒
Object
- .actions ⇒
undefined
- .actionCreators ⇒
Object
- .actionCreators ⇒
Undefined
- .components ⇒
Object
- .components ⇒
Undefined
- .routes ⇒
Object
- .routes ⇒
Undefined
- .reducers ⇒
Object
- .reducers ⇒
Undefined
- .submodules ⇒
Array
- .submodules ⇒
Undefined
- .addAction(name) ⇒
undefined
- .removeAction(name) ⇒
undefined
- .addActionCreator(name, actionCreator) ⇒
undefined
- .removeActionCreator(name) ⇒
Undefined
- .addReducer(name, reducer) ⇒
Undefined
- .removeReducer(name) ⇒
Undefined
- .addSubmodule(options) ⇒
Undefined
- .removeSubmodule(submodule) ⇒
Undefined
new Module(options)
Represents a composable collection of redux parts.
Param | Type | Description |
---|---|---|
options | Object |
The options object. |
options.name | String |
The name of the module. |
options.store | Object |
The Redux store instance. |
options.actions | Object |
The Redux actions the module can dispatch. |
options.actionCreators | Object |
The action creators for the actions. |
options.components | Object |
The components the module uses. |
options.routes | function |
The final route component returned from the module. |
options.reducers | Object |
The reducers of the module. They process the module's actions. |
options.submodules | Object |
An array of submodules. |
String
module.name ⇒ Returns the name of the module.
Kind: instance property of Module
Returns: String
- name - The name of the module
Undefined
module.name ⇒ Sets the name of the module.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the module. |
String
module.store ⇒ Returns the store of the module.
Kind: instance property of Module
Returns: String
- store - The store of the module
Undefined
module.store ⇒ Sets the store of the module and all it's submodules.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
store | Object |
The store. |
Object
module.actions ⇒ Returns the actions of the module.
Kind: instance property of Module
Returns: Object
- actions
undefined
module.actions ⇒ Replaces the actions.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
actions | Object |
The new actions. |
Object
module.actionCreators ⇒ Returns the actionCreators of the module.
Kind: instance property of Module
Returns: Object
- actionCreators
Undefined
module.actionCreators ⇒ Replaces the actionCreators.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
actionCreators | Object |
The new actionCreators. |
Object
module.components ⇒ Returns the components of the module.
Kind: instance property of Module
Returns: Object
- components
Undefined
module.components ⇒ Replaces the components.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
components | Object |
The new components. |
Object
module.routes ⇒ Calls the modules' routes function and composes it with the routes of the submodules, creating one route tree.
Kind: instance property of Module
Returns: Object
- Routes
Undefined
module.routes ⇒ Replaces the routes.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
routes | function |
The routes function. Returns a React Element. |
Object
module.reducers ⇒ Returns the reducers of the module combined with the reducers of the submodules.
Kind: instance property of Module
Returns: Object
- actions
Undefined
module.reducers ⇒ Replaces the reducers.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
reducers | Object |
The new reducers. |
Array
module.submodules ⇒ Returns the submodules of the module.
Kind: instance property of Module
Returns: Array
- submodules
Undefined
module.submodules ⇒ Replaces the submodules.
Kind: instance property of Module
Param | Type | Description |
---|---|---|
submodules | Array |
The new submodules. |
undefined
module.addAction(name) ⇒ Adds an action to the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the action. |
undefined
module.removeAction(name) ⇒ Removes an action from the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the action. |
undefined
module.addActionCreator(name, actionCreator) ⇒ Adds an actionCreator to the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the actionCreator. |
actionCreator | function |
The actionCreator function. |
Undefined
module.removeActionCreator(name) ⇒ Removes an actionCreator from the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the actionCreator. |
Undefined
module.addReducer(name, reducer) ⇒ Adds a reducer to the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the reducer. |
reducer | function |
The reducer function. |
Undefined
module.removeReducer(name) ⇒ Removes a reducer from the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
name | String |
The name of the reducer. |
Undefined
module.addSubmodule(options) ⇒ Adds a submodule to the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
options | Object |
The options for the submodule. |
Undefined
module.removeSubmodule(submodule) ⇒ Removes a submodule from the module.
Kind: instance method of Module
Param | Type | Description |
---|---|---|
submodule | Object |
The options for the submodule. |