4 ms·
Isn't this supposed to be a non issue because react can intelligently compare the higher level components of your application and decide whether they need to be
by foota 11y ago
Isn't this supposed to be a non issue because react can intelligently compare the higher level components of your application and decide whether they need to be re-rendered?
- Silhouette 11y agoThe trouble is, those comparisons might be relatively cheap compared to a DOM update, but they still aren't free. Even with an efficient overall algorithm and with all the multiples having a key property set to minimise unnecessary changes, if you're dealing with hundreds of components in your page that need rendering at any given time and that rendering in turn relies on significant conditional logic or derived information, those comparisons to see what rendering is needed (or, if you prefer, to determine whether re-rendering is needed) start to add up.
- foota 11y agoWhat's the scenario where you need to re-render hundreds of components? Is this something like a state change propagating down a long line of components? If you assume a roughly balanced tree like structure to your components though wouldn't even this still be bounded logarithmically by the number of components on the page?