我知道如何从同一个 reducer 中获取一个或多个值
uploadFetch = createEffect(() => {
return this.actions.pipe(
ofType(rdxUploadFetch),
withLatestFrom(this.store.select(getTestImageImageId)),
switchMap(ac => axiosInstance.post('/api/products', ac[2]).then(res => {
return {
type: RDX_UPLOAD_FETCH_SUCCESS
}
}))
)
})
但是我们如何实现一个 double withLatestFrom 来返回来自 2 个不同 reducer 的 2 条数据?或者我们如何创建一个选择器来从 2 个不同的 reducer 返回 2 条数据?
答案 0 :(得分:0)
uploadFetch = createEffect(() => {
return this.actions.pipe(
ofType(rdxUploadFetch),
withLatestFrom(this.store.select(getTestImageImageId), this.store.select(getKeesToken)),
map(ac => {
console.log(ac);
return {
type: RDX_UPLOAD_FETCH_SUCCESS
}
})
)
})