Track the browser window size with an optional update delay.
const { screenWidth, screenHeight } = useWindowSize(updateDelay);
Resize the window
Screen width: 0px
Screen height: 0px
import { useWindowSize } from 'kitzo'; function ViewportSize() { const { screenWidth, screenHeight } = useWindowSize(200); return ( <div> <p>Width: {screenWidth}px</p> <p>Height: {screenHeight}px</p> </div> ); }
| Parameter | Type | Description |
|---|---|---|
updateDelay | number | Delay in milliseconds to throttle window resize updates |
Returns the current window dimensions.