I want to get the width of a dynamic div after it's painted, but I can't tell how. This is what I am doing :
const ref=useRef();
useEffect(()=>{
console.log('REF',ref.current.offSetWidth)
},[])
return (
<div ref={ref}>
</div>
I tried window.resize eventListener, but it only gets triggered if the screen dimensions changed. My question is there anyway to get the width of a div after it renders on the screen ? I'm not setting the width beforehand, it's just taking 100% of parent element inside a flex box