DEMO
Dimensions - Infinity x Infinity
Resize the window to observe changes
useWindowSize
Reactive window size
Usage
import { useWindowSize } from '@react-hooks-library/core'
function Demo() {
const { height, width } = useWindowSize()
return (
<div>
Dimensions - {height} x {width}
</div>
)
}
Type Declarations
interface WindowSizeOptions {
initialWidth?: number
initialHeight?: number
}
/**
* Reactive window size.
*
* @param options
*
* @see https://react-hooks-library.vercel.app/core/useWindowSize
*/
declare function useWindowSize({
initialWidth,
initialHeight
}?: WindowSizeOptions): {
width: number
height: number
}