React Hook to Measure Element Bounds
JSON →`react-use-measure` is a utility hook for React applications designed to precisely measure the bounding box of a referenced DOM element. It provides reactive updates to an element's dimensions and position (`x`, `y`, `width`, `height`, `top`, `right`, `bottom`, `left`), responding to changes in size, window scroll, and even nested scroll areas, which significantly differentiates it from standard `getBoundingClientRect`. This addresses a common challenge in web development where relative coordinates and offsets within complex scrollable layouts are difficult to ascertain reliably. The package is currently stable at version 2.1.7, with recent minor fix releases indicating active maintenance. It is part of the `pmndrs` ecosystem and leverages `ResizeObserver` for efficient updates. It ships with TypeScript types, promoting strong typing in projects.
Traffic · last 30 days ↓37% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany