aboutsummaryrefslogblamecommitdiffstats
path: root/packages/instant/src/redux/store.ts
blob: 11bba3876e28b9c8c15e39caa81417b199076711 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                            
                                                                          
                                                                               
 
                                                             
                                                 
 


                                      

                                                    
                                                                                                             

      
import * as _ from 'lodash';
import { applyMiddleware, createStore, Store as ReduxStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';

import { analyticsMiddleware } from './analytics_middleware';
import { createReducer, State } from './reducer';

export type Store = ReduxStore<State>;

export const store = {
    create: (initialState: State): Store => {
        const reducer = createReducer(initialState);
        return createStore(reducer, initialState, composeWithDevTools(applyMiddleware(analyticsMiddleware)));
    },
};