React is not Fast, but efficient!

Andreas Sujono
4 min readAug 7, 2022

There’re a lot of misconceptions that describe React as fast. That is not true at all. It doesn’t mean React is bad, obviously because a lot of big companies still use React until now. In addition, Meta, the creator and core developer of React always improves and maintains their code to be fully performant.

Firstly, we do need to understand how React works and what problems do React and other frameworks want to solve. React uses Virtual DOM and reconciliation with diffing algorithm to “effectively” detect which HTML node is changed and only update that changed nodes. However, Virtual DOM is not fast. It adds an additional work or overhead behind the scenes to do all the comparisons between the real DOM and virtual DOM.

React and other frontend frameworks try to make web development more declarative and the development process faster. Imagine back in the good old days where for example, if we want to update text in a node, we would do something like this:

document.getElementById('text').innerHTML = "Updated Text"

Basically, we need to update the changed node directly. Things get more complicated if we want to create a new HTML node, append a child to a parent, etc. We must do it manually in an imperative way. There’s an advantage of doing this though, it is fast. In fact, the fastest because we dictate which…

--

--

Andreas Sujono

A Full Stack Developer with 5 years of working experience, Web2 and Web3 Enthusiast, twitter: @AndreasSujono2