尽管我正在绑定"_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));
});发布于 2017-09-06 12:05:48
问题是每次组件挂载时都会发生订阅,即subToConnectionChange被一次又一次地创建,而这种情况刚刚开始发生的原因是,当视图位于只加载一次的选项卡栏中时,删除了整个视图表单react导航选项卡栏。
https://stackoverflow.com/questions/46048189
复制相似问题