ZeeCoder / use-resize-observer

A React hook that allows you to use a ResizeObserver to measure an element's size.
MIT License
644 stars 42 forks source link

Using the same ResizeObserver instance for all hooks for better performance #84

Closed DanielGiljam closed 3 years ago

DanielGiljam commented 3 years ago

Have you considered using the same ResizeObserver for all hooks instead of creating a separate ResizeObserver instance for each hook? Multiple observers each observing one element seems to be less performant than one observer observing multiple elements (see https://github.com/WICG/resize-observer/issues/59#issuecomment-408098151).

ZeeCoder commented 3 years ago

Yes, feel free to chip in this discussion: https://github.com/ZeeCoder/use-resize-observer/discussions/80