Open looshi opened 8 years ago
The key benefit here is that you get dispatch and getState functions as params, this avoid the need to keep the Store object around. The "thunk" middleware will see you are returning a thunk instead of a normal action, it will pass the dispatch and getState functions to that function, and it just works. However, this is purely optional.
From @sikanhe notes :
you have some side effects in this action creator
and you’re using store.dispatch i recommend using redux thunk for any action that needs to call dispatch/access current state/calling remote api so with redux thunk, you will be able to do this