React 之componentWillUnmount
unmount v. 卸载,取消安装;
will 不用解释了吧
- 清除定时器
componentWillUnmount(){
clearTimeout(this.timer)
}
- 解绑dom事件
componentWillUnmount(){
window.onScroll = null
}
- 清除网络工作
componentWillUnmount(){
this.setState = (state,callback) => {
return
}
}