JSPM

  • Created
  • Published
  • Downloads 1673660
  • Score
    100M100P100Q200225F
  • 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.

npm version build

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>
  );
};

License

MIT