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.
npm install @reactutils/use-windows-size
# or
yarn add @reactutils/use-windows-size
import useWindowSize from '@reactutils/use-windows-size';
// Usage
function App() {
const size = useWindowSize();
return (
<div>
{size.width}px / {size.height}px
</div>
);
}