UI & Layout
useBoundingclientrectRef
About
A hook that tracks the boundingclientrect of an element. It returns a callbackRef so that the element node if changed is easily tracked.
Examples
Arguments
Doesn't take any arguments.
Returns an array of 3 values
| Return value | Type | Description | Default value |
|---|---|---|---|
| ref | Callback ref | A callback ref function to use as a ref for the component that needs to be tracked | () => null |
| value | DOMRect | DOMRect Object containing x,y, width, height, left,right,top and bottom keys | null |
| update | Function | Function that can be called at any time to force a recalculation of the clientrect | null |