Hacker News new | ask | show | jobs
by rimliu 2238 days ago
DOM operations are costly whether you do them or React does them. What React offers is avoiding unnecessary DOM operations. However if you need to perform two operations, and React still needs to perform two operations, vanilla will be faster by avoiding all the extra work with VirtualDOM rerendering and diffing. Virtual DOM is taken by many as granted and cost-free, which is not true. If your SPA is comples and hats a lot of components, then on each data change all thad virtual rerendering and diffing kicks off and even if at the end no DOM opreations need to be done, i.e. nothing changes visually all this adds up in terms of CPU resources.