完美解决 React 节流函数内存泄漏问题

import {throttle} from "lodash";
constructor(props){
super(props)
this.state={
list:[]
}
this.showScreen = throttle(this.showScreen,1000)
}
showScreen=(e)=>{
console.log(e)

}




componentWillUnmount = () => {
this.showScreen.cancel();
this.setState = (state, callback) => {
return;
};
}
posted @ 2019-08-22 17:22  沐少白  阅读(1604)  评论(0编辑  收藏  举报