const foo = () => ({
type: 'FOO',
payload: new Promise()
});
const foo = () => ({
type: 'FOO',
payload: {
promise: new Promise()
}
});
For more on using async/await, see the guide.
const foo = () => ({
type: 'FOO',
async payload() {
const data = await getDataFromApi():
return data;
}
});