Observe the size change of a reference.
Last updated 3 years ago
Was this helpful?
import { useResizeObserver, useResizeObserverState, } from "@atomico/hooks/use-resize-observer";
useResizeObserver( ref, (rect) => void );
Where:
ref: Ref, reference to observe the resizing.
ref
Ref
rect: Object, the return of DOMRectReadOnly.toJSON(), documentation of
rect
Object
DOMRectReadOnly.toJSON()
width
height
x
y
top
right
bottom
left
const rect = useResizeObserverState(ref);