A React component that allows you to use a ResizeObserver to measure an element's size.
yarn add @zeecoder/react-resize-observer
# or
npm install --save @zeecoder/react-resize-observer
const App = () => (
<ResizeObserver>
{(ref, width, height) => (
<div ref={ref}>
My size is {width}x{height}
</div>
)}
</ResizeObserver>
);
- Uses resize-observer-polyfill internally, which falls back to the native ResizeObserver, if available.
MIT