use-bounding-rect

0.1.0 • Public • Published

use-bounding-rect

npm install use-bounding-rect

A tiny React hook to access DOM Rect of an element dynamically.

import { useBoundingRect } from "use-bounding-rect";

function Wrapper() {
  let ref = useRef(null);
  let rect = useBoundingRect(ref);
  return (
    <div className="wrapper" ref={ref}>
      {rect != null ? <Content width={rect.width} height={rect.height} /> : null}
    </div>
  );
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.03latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.03

Package Sidebar

Install

npm i use-bounding-rect

Weekly Downloads

3

Version

0.1.0

License

ISC

Unpacked Size

2.46 kB

Total Files

4

Last publish

Collaborators

  • alexeyraspopov