-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async functions dispatch #107
Comments
@davibe It's quite safe. The same as you return promise and chain it. |
@TrySound so if i can do that, what is the meaning of my thunks return value ? i.e. i could write dispatch(async (dispatch, getState) => {
const data = await networkReq();
return { type: 'NEW_DATA', payload: data }
}); or without async dispatch((dispatch, getState) => {
return networkReq().then( (data) => {
return { type: 'NEW_DATA', payload: data }
});
}); For some reason i expected thunk to dispatch my final action without calling |
@davibe thunk delegates
But you can do this If you will use |
@TrySound i did also use |
Thank you for helping my neurons spin. I think i can close this now :) |
I discovered by accident that i can dispatch an async function like this
I wonder if this is because babel translates it into something that works by accident, or what. It it safe to assume this is right ?
The text was updated successfully, but these errors were encountered: