File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,11 @@ import { createStore, applyMiddleware } from 'redux';
80
80
import thunk from ' redux-thunk' ;
81
81
import rootReducer from ' ./reducers/index' ;
82
82
83
- // create a store that has redux-thunk middleware enabled
84
- const createStoreWithMiddleware = applyMiddleware (
85
- thunk
86
- )(createStore);
87
-
88
- const store = createStoreWithMiddleware (rootReducer);
83
+ // Note: this API requires redux@>=3.1.0
84
+ const store = createStore (
85
+ rootReducer,
86
+ applyMiddleware (thunk)
87
+ );
89
88
```
90
89
91
90
## Composition
@@ -97,11 +96,11 @@ import { createStore, applyMiddleware } from 'redux';
97
96
import thunk from ' redux-thunk' ;
98
97
import rootReducer from ' ./reducers' ;
99
98
100
- // applyMiddleware supercharges createStore with middleware:
101
- let createStoreWithMiddleware = applyMiddleware (thunk)( createStore);
102
-
103
- // We can use it exactly like “vanilla” createStore.
104
- let store = createStoreWithMiddleware (rootReducer );
99
+ // Note: this API requires redux@>=3.1.0
100
+ const store = createStore (
101
+ rootReducer,
102
+ applyMiddleware (thunk)
103
+ );
105
104
106
105
function fetchSecretSauce () {
107
106
return fetch (' https://www.google.com/search?q=secret+sauce' );
You can’t perform that action at this time.
0 commit comments