阵营本土阵营 - _this2.SetState不是一个函数
问题描述:
我越来越即使我做了绑定“_this2.SetState不是一个函数阵营本土阵营 - _this2.SetState不是一个函数
这里下面的错误是我的代码
// Subscribers to selected team change
const subToNewDataChange = subscribe('newData', state => {
const random = Math.random() * (100 - 15) + 15;
// Updates the state with the connection change and re renders the view
this.setState({key:random }, function() {
this.forceUpdate();
}.bind(this));
});
答
问题在于订阅每次都发生在组件安装上,也就是说,一次又一次创建了subToConnectionChange,并且刚开始发生的原因是当视图位于TabBar中时删除了整个视图窗体的反应导航Tabbar它只会加载一次。
很高兴听到这个问题解决:)干杯! –