SheetXL - v1.0.2
    Preparing search index...

    Function useMeasure

    • Tracks the content-box size of an element.

      Type Parameters

      • E extends Element = Element

      Returns [MeasureRef<E>, MeasureRect]

      Returns all zeros until the ref is attached; the element is measured as soon as it is attached (before paint) and again whenever a ResizeObserver reports a change. The returned rect keeps its identity while the size is unchanged. Where ResizeObserver is unavailable the rect stays zero.

      Changes from CSS transforms are not observed; see useAnimatedMeasure.

      const [refMeasure, { width }] = useMeasure<HTMLDivElement>();
      return <div ref={refMeasure}>{width}px wide</div>;