Skip to main content

useContainerSize

useContainerSize is a hook that observes and returns the size of a container on the page.

Import

import { useContainerSize } from '@dynatrace/strato-components-preview/core';

Use cases

The sizeRef is the ref which should be added to the container that needs to be observed. The result is a ContainerSize object, consisting of the width and height of the corresponding container.

CodeSandbox
Still have questions?
Find answers in the Dynatrace Community