ilokesto

Measure

Measure는 ResizeObserver로 컨테이너를 관찰하고 현재 { width, height }를 render prop으로 전달합니다. ref는 underlying div로 전달됩니다.

import { Measure } from '@ilokesto/utilinent';

<Measure>{({ width, height }) => <span>{width}×{height}</span>}</Measure>

프로퍼티

PropType설명
childrenReactNode | ({ width, height }) => ReactNodecontent, 선택적으로 크기를 받습니다.
boxResizeObserverBoxOptionsObserver box model입니다. 기본값은 content-box입니다.
initialSizeDOMRectReadOnly첫 observation 이전의 initial size입니다.

표준 div props와 ref가 관찰되는 element로 전달됩니다.

목차