When creating your stores you can provide configuration for more advanced scenarios.
We have split the configuration parameters into two groupings, standard and advanced. The advanced configuration options are used to customise the underlying Redux store.
# Standard configuration
name(string, optional, default=EasyPeasyStore)
Allows you to customise the name of the store. This is especially useful when you are creating multiple stores as you will easily be able to distinguish the store instances within the Redux Dev Tools Extension (opens new window).
version(number, optional, default=0)
Allows you to tag the "version" of your store. This is particularly useful when utilizing the persist APIs as they reference the version number to ensure that any persisted state matches the required store version prior to rehydrating the store. You can read more about this within the persist docs.
devTools(boolean | Object, optional, default=true)
Setting this to
falsewill disable the Redux Dev Tools Extension.
If you need to configure Redux Dev Tools with custom parameters (opens new window), you can do so by passing in an object.
Note: dev tools will be enabled by default if your
process.env.NODE_ENV !== 'production'.
disableImmer(boolean, optional, default=false)
If you set this to true, then immer (opens new window) will be disabled, meaning you can no longer mutate state directly within actions and will instead have to return new immutable state as is typical of standard Redux reducers.
initialState(Object, optional, default=undefined)
Allows you to hydrate your store with initial state (for example state received from your server in a server rendering context).
injections(Object, optional, default=undefined)
Any dependencies you would like to exposed to your thunks and effects. These are exposed via the
helpersargument to both APIs.
mockActions(boolean, optional, default=false)
Useful when testing your store, especially in the context of thunks. When set to
truenone of the actions dispatched will update the state, they will be instead recorded and can be accessed via the
getMockedActionsAPI that is added to the store. Please see the "Testing" section for more information.
# Advanced configuration
Under the hood we use Redux. You can customise the Redux store via the following Redux-specific configuration properties:
compose(Function, optional, default=undefined)
compose(opens new window) function that will be used in place of the one from Redux. This is especially useful in the context of React Native and other environments. See the Usage with React Native notes.
enhancers(Array, optional, default=)
Any custom store enhancers (opens new window) you would like to apply to your Redux store.
middleware(Array, optional, default=)
An array of Redux middleware (opens new window) you would like to attach to your store.
reducerEnhancer(Function, optional, default=(reducer => reducer))
Any additional reducerEnhancer you would like to enhance to your root reducer (for example you want to use redux-persist (opens new window)).