【发布时间】:2021-07-24 06:42:40
【问题描述】:
当我们派发一个 thunk 时,相应的承诺状态动作被派发,但是我们如何使用“then”而组件重新渲染多次(从承诺状态动作)?这对我来说没有意义。我不明白这个顺序。
import { unwrapResult } from '@reduxjs/toolkit'
// in the component
const onClick = () => {
dispatch(fetchUserById(userId))
.then(unwrapResult)
.then(originalPromiseResult => {})
.catch(rejectedValueOrSerializedError => {})
}
【问题讨论】:
标签: reactjs redux redux-thunk redux-toolkit