POST
为什么这个错误会继续显示?当我从我的应用程序注销时,此警告开始出现在控制台上。有人可以解释为什么会这样吗?
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the Clock component.
答案 0 :(得分:1)
{{1}}
答案 1 :(得分:1)
无需将tickId
存储在州内。
componentDidMount: function() {
this.tickId = setInterval(this.tick, 1000);
},
componentWillUnmount: function() {
clearInterval(this.tickId);
}