aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux/store.ts
blob: 505234299f862d0ab27f0f370b4c82e12250ab4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import * as _ from 'lodash';
import { createStore, Store as ReduxStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';

import { INITIAL_STATE, reducer, State } from './reducer';

export type Store = ReduxStore<State>;

export const store = {
    create: (withState: Partial<State>): Store => {
        const allInitialState = {
            INITIAL_STATE,
            ...withState,
        };
        return createStore(reducer, allInitialState, devToolsEnhancer({}));
    },
};