JSPM

  • Created
  • Published
  • Downloads 2060770
  • Score
    100M100P100Q205652F
  • License MIT

A React hook to use a Resize Observer

Package Exports

  • use-resize-observer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-resize-observer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

use-resize-observer

A React hook to use a Resize Observer.

Usage

import React, { useRef } from "react";
import useResizeObserver from "use-resize-observer";

const App = () => {
  const ref = useRef();
  const { width, height } = useResizeObserver(ref);

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