javascript redux async action code example
Example: asynch action redux
const handleAsync = () => {
return function(dispatch) {
dispatch(requestingData())
setTimeout(function() {
let data = {
users: ['Jeff', 'William', 'Alice']
}
// Dispatch received data action here(just a placeholder for API)
dispatch(receivedData(data))
}, 2500);
}
};