@@ -40,30 +40,28 @@ 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 ) :
54+ If you use Redux Thunk in a CommonJS environment:
5655
57- ``` diff
58- - const thunk = require('redux-thunk')
59- + const thunk = require('redux-thunk').default
56+ ``` js
57+ const { thunk } = require (' redux-thunk' )
6058```
6159
6260Additionally, since 2.x, we also support a
6361[ UMD build] ( https://unpkg.com/redux-thunk/dist/redux-thunk.min.js ) for use as a global script tag:
6462
6563``` js
66- const ReduxThunk = window .ReduxThunk
64+ const ReduxThunk = window .ReduxThunk . thunk
6765```
6866
6967</details >
@@ -73,7 +71,7 @@ Then, to enable Redux Thunk, use
7371
7472``` js
7573import { createStore , applyMiddleware } from ' redux'
76- import thunk from ' redux-thunk'
74+ import { thunk } from ' redux-thunk'
7775import rootReducer from ' ./reducers/index'
7876
7977const store = createStore (rootReducer, applyMiddleware (thunk))
0 commit comments