You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,30 @@ Thunk [middleware](http://redux.js.org/docs/advanced/Middleware.html) for Redux.
11
11
npm install --save redux-thunk
12
12
```
13
13
14
+
## Note on 2.x Update
15
+
16
+
Most tutorials today assume Redux Thunk 1.x so you might run into an issue when running their code with 2.x.
17
+
**If you use Redux Thunk 2.x in CommonJS environment, [don’t forget to add `.default` to your import](https://github.com/gaearon/redux-thunk/releases/tag/v2.0.0):**
18
+
19
+
```diff
20
+
- var ReduxThunk = require('redux-thunk')
21
+
+ var ReduxThunk = require('redux-thunk').default
22
+
```
23
+
24
+
If you used ES modules, you’re already all good:
25
+
26
+
```js
27
+
importReduxThunkfrom'redux-thunk'// no changes here 😀
28
+
```
29
+
30
+
Additionally, since 2.x, we also support a [UMD build](https://npmcdn.com/redux-thunk@2.0.1/dist/redux-thunk.min.js):
31
+
32
+
```js
33
+
var ReduxThunk =window.ReduxThunk.default
34
+
```
35
+
36
+
As you can see, it also requires `.default` at the end.
37
+
14
38
## Why Do I Need This?
15
39
16
40
If you’re not sure whether you need it, you probably don’t.
0 commit comments