Skip to content

Commit 879193a

Browse files
committed
Update to Redux 3.1 API
1 parent be45e6b commit 879193a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,11 @@ import { createStore, applyMiddleware } from 'redux';
8080
import thunk from 'redux-thunk';
8181
import rootReducer from './reducers/index';
8282

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+
);
8988
```
9089

9190
## Composition
@@ -97,11 +96,11 @@ import { createStore, applyMiddleware } from 'redux';
9796
import thunk from 'redux-thunk';
9897
import rootReducer from './reducers';
9998

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+
);
105104

106105
function fetchSecretSauce() {
107106
return fetch('https://www.google.com/search?q=secret+sauce');

0 commit comments

Comments
 (0)