Function useWindowSize

A custom hook that returns the current window size (width and height).

const { width, height } = useWindowSize();
console.log('window size:', { width, height });

The width and height are updated on window resize events. The initial values are set when the component first mounts.