Skip to content

Commit b721292

Browse files
authored
Update README to use named thunk export
1 parent 88008ea commit b721292

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,28 @@ npm install redux-thunk
4040
yarn 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

4848
If 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

6260
Additionally, 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
7573
import { createStore, applyMiddleware } from 'redux'
76-
import thunk from 'redux-thunk'
74+
import { thunk } from 'redux-thunk'
7775
import rootReducer from './reducers/index'
7876

7977
const store = createStore(rootReducer, applyMiddleware(thunk))

0 commit comments

Comments
 (0)