Skip to content

Commit 98bffb1

Browse files
authored
Merge pull request #360 from studiozeffa/readme-named-export
Update README to use named `thunk` export
2 parents 88008ea + 2fbc535 commit 98bffb1

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,21 @@ 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):
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
7566
import { createStore, applyMiddleware } from 'redux'
76-
import thunk from 'redux-thunk'
67+
import { thunk } from 'redux-thunk'
7768
import rootReducer from './reducers/index'
7869

7970
const store = createStore(rootReducer, applyMiddleware(thunk))
@@ -255,7 +246,7 @@ Promises to wait for each other’s completion:
255246

256247
```js
257248
import { createStore, applyMiddleware } from 'redux'
258-
import thunk from 'redux-thunk'
249+
import { thunk } from 'redux-thunk'
259250
import rootReducer from './reducers'
260251

261252
// Note: this API requires redux@>=3.1.0

0 commit comments

Comments
 (0)