Skip to content

A React hook that allows you to use a ResizeObserver to measure an element's size.

License

Notifications You must be signed in to change notification settings

muizzk/use-resize-observer

 
 

Repository files navigation

use-resize-observer

A React hook that allows you to use a ResizeObserver to measure an element's size.

npm version build

Install

yarn add use-resize-observer
# or
npm install --save use-resize-observer

Usage

import React from "react";
import useResizeObserver from "use-resize-observer";

const App = () => {
  const [ref, width, height] = useResizeObserver();

  return (
    <div ref={ref}>
      Size: {width}x{height}
    </div>
  );
};

Notes

Related

License

MIT

About

A React hook that allows you to use a ResizeObserver to measure an element's size.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%