📅  最后修改于: 2022-03-11 15:01:13.861000             🧑  作者: Mango
useEffect(() =>{
let windowLength = document.documentElement.clientWidth || window.innerWidth;
setWindowSize(windowLength);
},[])
console.log("onload is calling",windowSize);
window.onresize= ()=>{
let windowLength = document.documentElement.clientWidth || window.innerWidth;
setWindowSize(windowLength);
}