maslianok / react-resize-detector

A Cross-Browser, Event-based, Element Resize Detection for React
http://maslianok.github.io/react-resize-detector/
MIT License
1.25k stars 91 forks source link

`onFinishResize`? #203

Closed softmarshmallow closed 2 years ago

softmarshmallow commented 2 years ago

I'm trying to make an optimization logic for render heavy component, only to show while its container is not resizing.

I'm able to trigger start resize event with onResize, but I don't see a feature to listen onFinishResize or onEndResize

Cheers!

joaogardenberg commented 2 years ago

Yep, there's no onFinishResize or anything like that.

If your problem is you want to avoid the onResize being called lots of times in a row while resizing, you can do

useResizeDetector({
  onResize,
  refreshMode: 'debounce',
  refreshRate: 300
})

or something like that.

maslianok commented 2 years ago

Yep, there's no onFinishResize or anything like that.

If your problem is you want to avoid the onResize being called lots of times in a row while resizing, you can do

useResizeDetector({
  onResize,
  refreshMode: 'debounce',
  refreshRate: 300
})

or something like that.

Correct! Thank you 👍