ctrlplusb / react-sizeme

Make your React Components aware of their width and height!
MIT License
1.95k stars 94 forks source link

Use Resize Observer? #215

Open keul opened 3 years ago

keul commented 3 years ago

This pretty good library carries a not-so-small bundle size change: https://bundlephobia.com/package/react-sizeme@3.0.1

It seems this largely depends on the element-resize-detector dependency.

I'm wondering is you ever evaluated a switch to the Resize Observer API for this.

I know this would be a task to defer to element-resize-detector probably, but it seems that the author has a different opinion.

Any thoughts?

sean-tmg commented 3 years ago

Hi @keul;

It's a fair question. I am open to switching to the Resize Observer API, but for now I intend for this package to exist in order support a wider set of browsers. Once the ecosystem has evolved to a point that we no longer need to support older browsers I may update this package or declare it archived. 🙏

keul commented 3 years ago

@sean-tmg I understand the scope to support wider range of browsers! Just a note: there are some Resize Observer polyfills out there, so in case devs could add them if they really need to support older browsers