1 2 3 4 5 6 7 8 9 10 11 12 | import { createStore, Store } from 'redux' ; import { reducersRoot } from './reducers-root' ; import { IAllState } from './all-state' ; export function configureStore(): Store<IAllState> { const devTools: any = (window as any)[ '__REDUX_DEVTOOLS_EXTENSION__' ]; return createStore(reducersRoot(), devTools && devTools()); } |
Solution:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import { applyMiddleware, compose, createStore, Store } from 'redux' ; import { reducersRoot } from './reducers-root' ; import { IAllState } from './all-state' ; import ReduxThunk from 'redux-thunk' ; export function configureStore(): Store<IAllState> { const middlewares = applyMiddleware(ReduxThunk); const composeEnhancers = (window as any)[ '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' ] || compose; const composed = composeEnhancers(middlewares); return createStore(reducersRoot(), composed); } |
No comments:
Post a Comment