-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
-
关于 reaction$
reaction$ 感觉和 tostream , 再配合个 from 功能差不多
是不是可以直接用这个官方的维护性更好? -
关于 action 的一些疑问
import { types, effect, action } from 'mst-effect'
import { map, switchMap } from 'rxjs/operators'
const Model = types
.model({
value: types.string,
})
.actions((self) => ({
fetch: effect<string>(self, (payload$) => {
function setValue(value: string) {
self.value = value
}
return payload$.pipe(
switchMap((url) => fetch$(url)),
map((value) => action(setValue, value)),
)
}),
}))其中
function setValue(value: string) {
self.value = value
}这一部分可以写在和 fetch 同级的地方吗? 这样好像方便 compose 一些?
- 老实讲, 整个库还是让我有点困惑
https://egghead.io/lessons/react-defining-asynchronous-processes-using-flow
2分51秒的地方

在 getSuggestion 的地方直接使用 rxjs, 在 subscribe 调用下 mst 的 actions 不就可以了? 为何如此大动周折?
Metadata
Metadata
Assignees
Labels
No labels