react-element-size
v1.1.0
Published
React hook to get size of any element
Downloads
12
Readme
react-element-size
React hook to get size of any element.
Installation
yarn add react-element-size
Usage
import React from "react";
import useElementSize from "react-element-size";
export default function App() {
const app = useElementSize();
const box = useElementSize();
return (
<div className="App" ref={app.setRef}>
<span>{JSON.stringify(app.size)}</span>
<div className="Box" ref={box.setRef}>
<span>{JSON.stringify(box.size)}</span>
</div>
</div>
);
}