Custom React hook that retrieves the offset size (width and height) of a referenced element.
This hook listens for resize events on the specified element and updates
the offsetWidth and offsetHeight states whenever the size of the
element changes. The offset size includes padding, scrollbars, and borders,
but excludes margins.
Custom React hook that retrieves the offset size (width and height) of a referenced element.
This hook listens for resize events on the specified element and updates the
offsetWidth
andoffsetHeight
states whenever the size of the element changes. The offset size includes padding, scrollbars, and borders, but excludes margins.Example