Redux 如何等待动作通过减速器?
我正在使用redux和redux thunk 我有以下代码:Redux 如何等待动作通过减速器?,redux,Redux,我正在使用redux和redux thunk 我有以下代码: export function initialAuth() { return (dispatch, getState) => { dispatch(authApp()).then( (token) => { dispatch(fetchUserProfile(token)).then(() => { dispatch(displayUserProfi
export function initialAuth() {
return (dispatch, getState) => {
dispatch(authApp()).then(
(token) => {
dispatch(fetchUserProfile(token)).then(() => {
dispatch(displayUserProfile(token))
})
}
)
}
}
我遇到的问题是dispatch(displayUserProfile(token))
只等待动作被调度,而不等待动作通过reducer
我实际上需要这个动作通过减速器,然后分派另一个动作。应该怎么做呢?看看,使用生成器而不是回调可以更轻松地处理副作用。看看,使用生成器而不是回调可以更轻松地处理副作用