@reactutils/use-windows-size
v1.0.0
Published
This hook returns an object containing the window's width and height.
Downloads
14
Maintainers
Readme
@reactutils/use-windows-size
this hook returns an object containing the window's width and height. If executed server-side (no window object) the value of width and height will be undefined.
Installation
npm install @reactutils/use-windows-size
# or
yarn add @reactutils/use-windows-size
Usage
import useWindowSize from '@reactutils/use-windows-size';
// Usage
function App() {
const size = useWindowSize();
return (
<div>
{size.width}px / {size.height}px
</div>
);
}