In React-redux project, sometimes we need to execute two actions.
For example,
// I have to both
handleAddItem(){
this.props.actions.addItem(); // working
this.props.actions.updateItemList(); // not working
}
Above code is not working. It just seems to be executed first action addItem()
. updateItemList()
is not working.
But I found hack to execute both actions,
handleAddItem(){
this.props.actions.addItem(); // working
setTimeout(()=>{
this.props.actions.updateItemList(); // It's working
}, 1000);
}
Is there accurate code to execute 2 more actions?