@@ -40,30 +40,21 @@ npm install redux-thunk
4040yarn add redux-thunk
4141```
4242
43- The thunk middleware is the default export.
43+ The thunk middleware is a named export.
4444
4545<details >
4646<summary ><b >More Details: Importing the thunk middleware</b ></summary >
4747
4848If you're using ES modules:
4949
5050``` js
51- import thunk from ' redux-thunk' // no changes here 😀
51+ import { thunk } from ' redux-thunk'
5252```
5353
54- If you use Redux Thunk 2.x in a CommonJS environment,
55- [ don’t forget to add ` .default ` to your import] ( https://github.com/reduxjs/redux-thunk/releases/tag/v2.0.0 ) :
56-
57- ``` diff
58- - const thunk = require('redux-thunk')
59- + const thunk = require('redux-thunk').default
60- ```
61-
62- Additionally, since 2.x, we also support a
63- [ UMD build] ( https://unpkg.com/redux-thunk/dist/redux-thunk.min.js ) for use as a global script tag:
54+ If you use Redux Thunk in a CommonJS environment:
6455
6556``` js
66- const ReduxThunk = window . ReduxThunk
57+ const { thunk } = require ( ' redux-thunk ' )
6758```
6859
6960</details >
@@ -73,7 +64,7 @@ Then, to enable Redux Thunk, use
7364
7465``` js
7566import { createStore , applyMiddleware } from ' redux'
76- import thunk from ' redux-thunk'
67+ import { thunk } from ' redux-thunk'
7768import rootReducer from ' ./reducers/index'
7869
7970const store = createStore (rootReducer, applyMiddleware (thunk))
@@ -255,7 +246,7 @@ Promises to wait for each other’s completion:
255246
256247``` js
257248import { createStore , applyMiddleware } from ' redux'
258- import thunk from ' redux-thunk'
249+ import { thunk } from ' redux-thunk'
259250import rootReducer from ' ./reducers'
260251
261252// Note: this API requires redux@>=3.1.0
0 commit comments