nkbt / react-height

Component-wrapper to determine and report children elements height
MIT License
180 stars 27 forks source link

Replace unsafe lifecycle with hook #43

Closed lanhhv84 closed 3 years ago

nkbt commented 4 years ago
  1. The reason I haven’t rewritten this libs with hooks (though almost all of my work codebase was upgraded) is to keep it compatible with existing react dependencies and so there is no need to do a major release as this lib is effectively canned, preserving it’s imperfect but performant approach.

  2. Dom element reference is still preserved in the state and does not fix the main concern of #42. I don’t believe storing dom element or children in state is a good idea. Especially for the component whose whole purpose is to be lightweight so it can be used in a table with 1000s of rows for example without much perf/mem penalties.

I am pretty sure it is possible to avoid storing them in state