React Redux 中mapStateToProps 和mapDispatchToProps 之间的区别

问题描述 投票:0回答:1

React Redux 中mapStateToProps() 和mapDispatchToProps() 之间的区别? 我最近开始在学习中使用react-redux。我不知道两者都必须使用的地方。谁能解释一下我吗?以及两者同时使用的情况是什么。

javascript redux react-redux
1个回答
0
投票

mapStateToProps

mapStateToProps() returns an object with props derived from the state.

mapDispatchToProps

 mapDispatchToProps() returns an object with functions that dispatch actions
© www.soinside.com 2019 - 2024. All rights reserved.