antonioru / beautiful-react-hooks

🔥 A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development 🔥

Home Page:https://antonioru.github.io/beautiful-react-hooks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useResizeObserver is improperly described in docs

ckperez opened this issue · comments

Uses the ResizeObserver API to observe changes within the given HTML Element DOM Rect.

Asynchronously observes changes in the DOM Rect of the given HTML Element.

These lines from the docs (emphasis my own) suggest that the values of the DOMRect are being observed for changes to them. The DOMRect is largely positional data from which the size of an element can be calculated. This hook observes changes to the size of the provided element and returns DOMRect data, but it does not observe the DOMRect data for the changes.

A button which is moved within its parent as part of a responsive UI due to a window resize will have new DOMRect values after the move, but that move would not be observed by this hook (nor by the resizeObserver at all) if the button were the element observed by it.

commented

Hi @ckperez thanks for opening this issue, please feel free to open a PR to fix the doc :)

thanks

commented

I'm closing this as it has been fixed by #372