Skip to content

useElementSize ​

Category
Elements

Hook that observes and returns the width and height of element

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

Usage ​

typescript
const { value } = useElementSize(ref);
// or
const { ref, value } = useElementSize();

Demo ​

Api ​

Parameters

NameTypeDefaultNote
targetUseElementSizeTarget-The target element to observe

Contributors ​

Source • Demo