Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 392 Bytes

useMeasure.md

File metadata and controls

24 lines (17 loc) · 392 Bytes

useMeasure

React sensor hook that reacts to changes in size of any of the observed elements.

Usage

import { useMeasure } from "react-use";

const Demo = () => {
  const [ref, { width, height }] = useMeasure();

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

Related hooks