silverwolf-x's picture
download
raw
469 Bytes
import { useEffect, useState } from 'react'
export function useMeasureWidth(
ref: React.RefObject<HTMLDivElement | null>
): number {
const [width, setWidth] = useState<number>(0)
useEffect(() => {
const el = ref.current
if (!el) {
return
}
const observer = new ResizeObserver(([{ contentRect }]) => {
setWidth(contentRect.width)
})
observer.observe(el)
return () => observer.disconnect()
}, [ref])
return width
}

Xet Storage Details

Size:
469 Bytes
·
Xet hash:
1637c620efe3a6c771e58a1a64077dabd2d081714d8896e4e1a24cdf3f1e0a19

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.