Module: store

Source:

Methods


<inner> createStore(modules [, autoRestore], history [, initialState] [, isImmutable] [, middlewares] [, thunk])

create a store based on the options passed

Parameters:
Name Type Argument Default Description
modules Array.<(Object|function())>

array of modules or reducers to use in the store creation

autoRestore boolean <optional>
false

whether the state should be kept in sessionStorage and automatically restored

history Object

history object to use for creation of the store

initialState Object <optional>
{}

state to hydrate the store with upon creation

isImmutable boolean <optional>
false

whether to use redux-immutable when combining reducers (if using ImmutableJS)

middlewares Array.<(Object|function())> <optional>
[]

array of middlewares to use in the store creation

thunk boolean <optional>
true

whether to include redux-thunk in the middlewares used in the store creation

Source:
Returns:
Type
Store
Example
import {
 createStore
} from 'arco';

import appModule from 'modules/app';
import fooModule from 'modules/foo';
import barModule from 'modules/bar';

const store = createStore([appModule, fooModule, barModule], {
 shouldRestoreState: true
});