为啥 redux action 需要能够 serializable?

讨论 未结 4 46
jchnxu
jchnxu 会员 2022年9月27日 13:46 发表
收藏(0)  分享
相关标签: 灌水交流
注意:本文归作者所有,未经作者允许,不得转载
4个回复
  • sweetcola
    2022年9月27日 14:16
    As with state, serializable actions enable several of Redux's defining features, such as time travel debugging, and recording and replaying actions. 标题下面第一句就回答了 > For this tutorial, we assume that you're using Redux Toolkit and React Redux together, as that is the standard Redux usage pattern. RTK(Redux Toolkit) 已经是目前的 Redux 的标准写法了,该抛弃以前的这种旧写法了。
    0 0
  • jchnxu
    2022年9月27日 14:50
    RTK 也要创建 action 啊,只是没有字符串而已。或者我应该这么问,time travel 其实 直接用 state diff 就能做了,抽象一层 action 的好处是? 主要是我 95% 的 action 就是 SET_LOADING, SET_XXX 。 很想直接写 state.isLoading = ... 即便是复杂一点的,一个 normalized 后的 state ,也能直接写。 ``` getUsers => state.topUserIds.map(u => state.userStore[]); ``` 找到一篇作者的回答,但这并不能太说服我。
    0 0
  • ospider
    2022年9月27日 15:49
    精力还是别放在 redux 这种过时的东西上了……
    0 0
  • Dotennin
    2022年9月27日 16:16
    确实烦, 一般会通用的 action, 作为 state 接口互动
    0 0