useElementDimensions
Returns element width and height and observes changes with ResizeObserver on which given red is attached
Usage
API
useElementDimensions
returns a ref
object that should be passed to the observed element, and the element's height
and width
.
On the first render (as well as during SSR), or when no element is being observed, width
and height
properties are equal to 0
.
Definition
Please note
This hook is extended on another hook called useResizeObserver
. To know more you can read the source code of useElementDimensions
.