Skip to content

useWindowSize ​

Category
Browser

Hook that manages a window size

typescript
import { useWindowSize } from '@siberiacancode/reactuse';

Usage ​

typescript
const { width, height } = useWindowSize();

Demo ​

Api ​

Parameters

NameTypeDefaultNote
params.initialWidth?numberNumber.POSITIVE_INFINITYThe initial window width
params.initialHeight?numberNumber.POSITIVE_INFINITYThe initial window height

Contributors ​

Source • Demo