useElementSize
Track element dimensions.
useElementSize.tsx
import { useElementSize } from "@cermuel/hooks/react";export function useElementSizeExample() { const { ref, width, height } = useElementSize<HTMLDivElement>(); return <div ref={ref}>{width} x {height}</div>;}Props
Param
Type
Default Value
No props for this hook
Returns
{ width: number; height: number; ref: import("react").RefObject<T | null>; }