Get the width and height of the viewport
const MyComponent = () => { const [width, height] = useWindowSize(); return <div>Window is {width} by {height}</div>} Copy
const MyComponent = () => { const [width, height] = useWindowSize(); return <div>Window is {width} by {height}</div>}
Tuple with width and height integers
Generated using TypeDoc
Get the width and height of the viewport
Example