File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- import { createStore , applyMiddleware } from 'redux' ;
1+ import { createStore , applyMiddleware , compose } from 'redux' ;
22import thunk from 'redux-thunk' ;
33import reducer from '../reducers' ;
44
5- const createStoreWithMiddleware = applyMiddleware (
6- thunk
7- ) ( createStore ) ;
8-
95export default function configureStore ( initialState ) {
10- const store = ( window . devToolsExtension ? window . devToolsExtension ( createStoreWithMiddleware ) : createStoreWithMiddleware ) ( reducer , initialState ) ;
6+ const finalCreateStore = compose (
7+ applyMiddleware ( thunk ) ,
8+ ) ( createStore ) ;
9+
10+ const store = finalCreateStore ( reducer , initialState ) ;
1111
1212 if ( module . hot ) {
1313 // Enable Webpack hot module replacement for reducers
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { createStore } from 'redux';
22import rootReducer from '../reducers' ;
33
44export default function configureStore ( initialState ) {
5- const store = ( window . devToolsExtension ? window . devToolsExtension ( createStore ) : createStore ) ( rootReducer , initialState ) ;
5+ const store = createStore ( rootReducer , initialState ) ;
66
77 if ( module . hot ) {
88 // Enable Webpack hot module replacement for reducers
You can’t perform that action at this time.
0 commit comments