import { applyMiddleware , createStore } from 'redux' ; import thunk from 'redux-thunk' ; import app from './reducers/CombinedReducers' ; declare const window ; declare const require ; declare const module ; let store = null ; function installStore ( createdStore ) { store = createdStore ; } function createAppStore ( ) { const devtools = window . devToolsExtension ? window . devToolsExtension ( ) : ( f ) => f ; const middleware = applyMiddleware ( thunk ) ; installStore ( middleware ( devtools ( createStore ) ) ( app , { } ) ) ; if ( module && module . hot ) { module . hot . accept ( './reducers/CombinedReducers' , ( ) => { const updated = require ( './reducers/CombinedReducers' ) . default ; store . replaceReducer ( updated ) ; } ) ; } } export function getStore ( ) { if ( store !== null ) { return store ; } createAppStore ( ) ; return store ; }