完美解決 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;    };}
相關文章
相關標籤/搜索