😎 📏 React hook to measure an element's size and handle responsive components.
Fix the type of the width
and height
states #775
loop limit exceeded
, thanks to @cornelius-behrend (#501)- const { observe } = useDimensions<HTMLDivElement | null>();
+ const { observe } = useDimensions<HTMLDivElement>();
Fix: un-observe the previous target element when updating the new target element via the observe
API
ref
API, use observe
instead, see this example
ref
option, if you want to share a ref
see this example