react-native允许我直接操纵道具

时间:2018-08-19 20:15:57

标签: react-native react-redux

我正在使用react-native和react-redux创建一个简单的应用程序。因此,我所有的道具都是从redux传来的mapStateToProps传入的。

我应该使用mapDispachToProps来操纵道具,但这不是正在发生的事情。

我有一个事件处理程序,可让我直接操纵道具。为什么会发生这种现象?

nameHandler(text) {
    console.log(this.props.group.name); //output: Billy
    this.props.group.name = 'illegal!';
    console.log(this.props.group.name); // output: illegal!
}

我将'this'绑定到构造函数中的'nameHandler',但这似乎并不相关。

我基本上已经解决了这个问题,但是这 不可能吗?

0 个答案:

没有答案