@trashpanda001/helpers
    Preparing search index...

    Function useResizeObserver

    • Parameters

      • ref: RefObject<null | HTMLElement>

        element ref

      Returns DOMRectReadOnly

      size and position of a rectangle

      import { useResizeObserver } from "@trashpanda001/helpers/react"
      import { useRef } from "react"

      function Component() {
      const ref = useRef<HTMLDivElement>(null)
      const rect = useResizeObserver(ref)
      console.log(rect)
      return <div ref={ref} style={{ width: "100px", height: "100px" }} />
      }