here is my code
{isVisible?
<Image
ref = {imageRef}
src={url}
fit="contain"
/>
:
<Box
sx={
{height:imageRef.current?.offsetHeight,
width:imageRef.current?.offsetWidth}
}>
</Box>
}
Is there any way to get Image height and width when isVisible is false?
I have tried like above,if isVisible is false Box can't get height and width in the first render,imageRef.current.offsetHeight is undefined.