Gets the window size and listens for resizes
initialWidth: Number: initial width used as a fallback for SSRinitialHeight: Number: initial height used as a fallback for SSR
state: Objectwidth: Number: width of the window's viewportheight: Number: height of the window's viewport
import { useWindowSize } from "react-recipes";
function App() {
const { width, height } = useWindowSize();
return (
<div>
{width}px / {height}px
</div>
);
}