Redux
Adds Redux state management.
Usage
Run the following command in the plugin directoy:
Then in your boot function, pass the plugin like this:
Filters
This plugin provides complete flexibility to modify the main redux store. This is done by providing various filter hooks at different stages of store initialization. All filter hooks of this plugin are executed during the execution of bluerain.system.app
filter hook.
Summary
bluerain.redux.beforeInit
This hook is executed before anyother hooks are registered or executed.
bluerain.redux.app
This hook gives the ability to modify the main System App component that gets wrapped in Redux's Provider.
Parameters:
Name | Type | Description |
SystemApp | React.Component | The main system app component. |
Returns:
Name | Type | Description |
SystemApp | React.Component | The main system app component. |
Example:
This example wraps the System App with a Redux provider by using a withRedux
higher order component (HOC).
bluerain.redux.initialState
This hook gives the ability to modify the initial state sent to the redux store.
Parameters:
Name | Type | Description |
initialState | Object | initialState Object |
Returns:
Name | Type | Description |
initialState | Object | initialState Object |
Example:
This example sets the bluerain.taskbar.active
state of the redux store to true at system boot time.
bluerain.redux.reducers
This hook gives the ability to modify the redux store's reducer.
Parameters:
Name | Type | Description |
reducers | Object | The reducer object. This object will be sent as a param to the |
Returns:
Name | Type | Description |
reducers | Object | The reducer object. This object will be sent as a param to the |
Example:
This example adds a reducer to bluerain state, which will be accessible at foo
.
bluerain.redux.reducers.bluerain
This hook gives the ability to modify the nested bluerain reducer.
Parameters:
Name | Type | Description |
reducers | Object | The reducer object. This object will be sent as a param to the |
Returns:
Name | Type | Description |
reducers | Object | The reducer object. This object will be sent as a param to the |
Example:
This example adds a taskbar reducer to bluerain state, which will be accessible at bluerain.taskbar
.
bluerain.redux.middlewares
This hook gives the ability to add or modify custom middlewares to the main redux store.
Parameters:
Name | Type | Description |
middlewares | Array | This is an array of redux middlewares. This array will be sent as a param to the |
Returns:
Name | Type | Description |
middlewares | Array | This is an array of redux middlewares. This array will be sent as a param to the |
Example:
This example adds a taskbar reducer to bluerain state, which will be accessible at bluerain.taskbar
.
bluerain.redux.enhancers
This hook gives the ability to modify the redux enhancers array. After execution, this array will be sent to the redux's compose
function.
Parameters:
Name | Type | Description |
enhancers | Array | This is an array of redux enhancers. This array will be sent as a param to the |
middlewares | Array | This is an array of redux middlewares. This array was used to create the enhancer (by passing as a param to |
Returns:
Name | Type | Description |
enhancers | Array | This is an array of redux enhancers. This array will be sent as a param to the |
bluerain.redux.composed
This hook gives the ability to modify the final composed enhancers
array (by passing enhancers array as a parameter to the compose
function), right before they are used in the redux store. Parameters:
Name | Type | Description |
composed | Array | This is the composed enhancers array (by passing |
enhancers | Array | This is an array of redux middlewares. This array was passed as a parameter to the |
Returns:
Name | Type | Description |
composed | Array | This is the composed enhancers array (by passing |
bluerain.redux.provider
This hook gives the ability to modify the Provider component of the redux store.
Parameters:
Name | Type | Description |
Provider | Provider | The react-redux Provider component |
Returns:
Name | Type | Description |
Provider | Provider | The react-redux Provider component |
Example:
This example replaces the original provider with Apollo's provider.
API
ReduxPlugin
Extends Plugin
Add Redux state management to BlueRain Apps
Properties
StoreRef
This plugin saves store
object in the BlueRain context. This can be accessed in the following way:
Last updated