DEV Community

Discussion on: Managing asynchronous actions in Redux

Collapse
 
whataluckyguy profile image
Lalit Kumar

I also got that on another site

kodlogs.com/34843/error-actions-mu...

Solution :
I had also faced the similar issue in the recent past. I did lot of research on it and found the solution on it. This is the very common problem with the people getting started.

You must dispatch after async request ends.

This program would work:

export function bindAllComments(postAllId) {
return function (dispatch){
return API.fetchComments(postAllId).then(comments => {
// dispatch
dispatch( {
type: BIND_COMMENTS,
comments,
postAllId
})
})
}
}