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
Péter Hauszknecht edited this page Aug 23, 2017
·
1 revision
Thunk middleware
Thunk is a repatch middleware to handle async actions. It is very similar to redux-thunk. Thunk middleware allows you to create reducers that returns a function (delegate). The delegate will be fired at dispatching.
dispatch (Store.dispatch): The dispatch method of the Store instance. With this you can dispatch any reducer to the store.
getState (Store.getState): The getState method of the Store instance. With this you can get the current state of the store.
extraArgument (any): An extra argument that you can provide at adding the thunk middleware. The extraArgument could be anything what you want. It is useful to keep the delegates side-effect-less.
Returns
(any): Delegate can return anything. If your delegate returns a Promise, you can chain your async actions to each other.