Skip to content

useWindowSize ​

elements
test coverage
Last changed: last month

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

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarhywax

Released under the MIT License.