完美解决 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;
};
}
原文地址:https://www.cnblogs.com/msb-/p/11395601.html