Closed
Description
Instead of having them as options, I think it would be better to ship composing hooks, basically as they are outlined in the readme already:
- https://github.com/ZeeCoder/use-resize-observer#throttle--debounce
- https://codesandbox.io/s/use-resize-observer-throttle-and-debounce-8uvsg
This would allow me to keep the base interface minimalistic, while at the same time offer solutions to a seemingly frequent use case.
This is how it would look I think:
import useResizeObserver from 'use-resize-observer/throttled';
import useResizeObserver from 'use-resize-observer/debounced';
// Where the API / options are the exact same.
The only downside that I would probably have to provide polyfilled builds as well, so maybe:
import useResizeObserver from 'use-resize-observer/throttled/polyfilled';
import useResizeObserver from 'use-resize-observer/debounced/polyfilled';
And of course I would have to run the whole test suite and more on these builds.
I'll just leave this issue here to assess demand.