useElementSize
An element's size, kept current with a ResizeObserver.
Measures the border box and follows resizes, for container-driven layouts, truncation and drawing at real pixel sizes. Returns a callback ref and the size; onResize receives each size without a render.
Usage
Examples
Layout from the container width
API
3 options
2 return values
Accessibility
Size-driven layouts must still reflow at 400% zoom and keep reading order; prefer CSS container queries when only styles change.
Notes
- Charts measure themselves; use this for your own canvases and layouts.