完美解决 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;
};
}