Hacker News new | ask | show | jobs
by SebastianKra 398 days ago
That comparison is apples to oranges, because React components are typically much smaller than Vue components (think 20 components in one file). So while its true that a state update will rebuild an entire component, that diff might still only impact 2-3 dom nodes.

For high frequency updates such as reacting to mouse interactions, you can compose components in such a way that only one small component handles the high-frequency update, while it's siblings and children remain static.

In this way, React-components are closer to Vue's computed properties than Vue-components.

1 comments

> So while its true that a state update will rebuild an entire component

What if the component does some long computations, for example, calculating a sum of 10000 elements of an array? React will do the computation only to find that nothing changed.

Put that computation in a useMemo and you're good.
This example just sounds like it was coded poorly. I would assume that experienced React developers would know to avoid something like this.

For inexperienced developers, you don’t need a framework to do something dumb.