I see the point you're trying to reach with using the middleware for async actions but I don't understand what you did here in this example:
var asyncSayActionCreator_1 = function (message) {
return function (dispatch) {
setTimeout(function () {
dispatch({
type: 'SAY',
message
})
}, 2000)
}
}
console.log("\n", 'Running our async action creator:', "\n")
store_0.dispatch(asyncSayActionCreator_1('Hi'))
so asyncSayActionCreator_1is a function that takes a message as a parameter but it also returns a function that is expecting a dispatch method as a parameter to later invoke on the actual async action object passed to setTimeout.
in this example you are calling store_0.dispatch on the ActionCreator itself which doesn't make sense to me
store_0.dispatch(asyncSayActionCreator_1('Hi'))
Wouldn't this example make more sense and actually dispatch the asyncAction?
I see the point you're trying to reach with using the middleware for async actions but I don't understand what you did here in this example:
so
asyncSayActionCreator_1
is a function that takes a message as a parameter but it also returns a function that is expecting a dispatch method as a parameter to later invoke on the actual async action object passed to setTimeout.in this example you are calling store_0.dispatch on the ActionCreator itself which doesn't make sense to me
Wouldn't this example make more sense and actually dispatch the asyncAction?