Obtenha o tamanho da janela para redimensionar

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);
  }
coderyogi