Redux
Last updated
Last updated
Adds Redux state management.
Run the following command in the plugin directoy:
Then in your boot function, pass the plugin like this:
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.
This hook is executed before anyother hooks are registered or executed.
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).
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.
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 combineReducers
of Redux after callback execution.
Returns:
Name
Type
Description
reducers
Object
The reducer object. This object will be sent as a param to the combineReducers
of Redux after callback execution.
Example:
This example adds a reducer to bluerain state, which will be accessible at foo
.
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 combineReducers
of Redux after callback execution.
Returns:
Name
Type
Description
reducers
Object
The reducer object. This object will be sent as a param to the combineReducers
of Redux after callback execution.
Example:
This example adds a taskbar reducer to bluerain state, which will be accessible at bluerain.taskbar
.
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 applyMiddleware
of Redux after callback execution.
Returns:
Name
Type
Description
middlewares
Array
This is an array of redux middlewares. This array will be sent as a param to the applyMiddleware
of Redux after callback execution.
Example:
This example adds a taskbar reducer to bluerain state, which will be accessible at bluerain.taskbar
.
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 compose
of Redux after callback execution.
middlewares
Array
This is an array of redux middlewares. This array was used to create the enhancer (by passing as a param to applyMiddleware
function) that was sent inside the array as the first param of this function.
Returns:
Name
Type
Description
enhancers
Array
This is an array of redux enhancers. This array will be sent as a param to the compose
of Redux after callback execution.
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 as a parameter to the compose
function), right before they are used in the redux store.
enhancers
Array
This is an array of redux middlewares. This array was passed as a parameter to the compose
function. The result was as the first param of this function.
Returns:
Name
Type
Description
composed
Array
This is the composed enhancers array (by passing enhancers
array as a parameter to the compose
function), right before they are used in the redux store.
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.
Extends Plugin
Add Redux state management to BlueRain Apps
Properties
This plugin saves store
object in the BlueRain context. This can be accessed in the following way:
pluginName
"Redux"
slug
"redux"