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:
Returns:
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:
Returns:
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:
Returns:
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:
Returns:
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:
Returns:
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:
Returns:
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:
Returns:
bluerain.redux.provider
This hook gives the ability to modify the Provider component of the redux store.
Parameters:
Returns:
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