3

我在redux reducer 中有一个标准化状态,并且希望将对象作为视图模型加入,例如帖子、评论和喜欢。因此,在每个操作上,都mapStateToProps通过三个集合之间的自定义连接来执行繁重的工作。有没有办法避免这种昂贵的重新计算?

我听说过,reselect但不知道如何在我的情况下使用它。

减速器状态如下所示:

posts: {'postId':{...postDataWithReferenesToCommentsAndLikeAuthors}}
comments: {'commentId':{...commentDataWithReferenesToCommentAuthors}}
users: {'userId':{...userData}}

我正在将这些地图合并mapStateToProps到每个帖子或评论编辑中,而且速度很慢,无法使用。

整体情况示意图

4

0 回答 0