Loading...
Please waitLoading...
Please waitpnpm dlx uselab@latest add use-window-size
import { useWindowSize } from "@/hooks/use-window-size"
const WindowSizeDisplay = () => {
const { width, height } = useWindowSize()
return (
<div>
<p>Window Width: {width}px</p>
<p>Window Height: {height}px</p>
</div>
)
}| Name | Type | Description |
|---|---|---|
width | number | The current width of the window, in pixels. |
height | number | The current height of the window, in pixels. |
Inner W: 0px
Inner H: 0px
Outer W: 0px
Outer H: 0px
Resize the window to see the width and height update in real-time!