useWindowSize
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
import { useWindowSize } from "@hua-labs/hua/framework";tsx
const { width, height, isMounted } = useWindowSize();
if (!isMounted) return null;
return (
<p>Window: {width} x {height}</p>
);| debounce | number | 100 | Debounce delay in milliseconds |
| initialWidth | number | 0 | Initial width for SSR |
| initialHeight | number | 0 | Initial height for SSR |
| width | number | Window inner width |
| height | number | Window inner height |
| isMounted | boolean | Whether component is mounted (SSR safety) |