Re:Netflix Likes React
by mynegation on Wednesday January 28, 2015 @05:11PM
(#8962879)
Because when your code changes DOM, browser does not know whether you are going to stop at it for now, or do something else, so it has to re-render. In React you explicitly request application of virtual DOM changes to real DOM once you are done.
[ Parent
| on HN ]
In theory they could add some new methods to the DOM api to allow for this, but it would be non-standard and currently none of the browsers have it.
Something like this maybe?
batchDomChanges(); ... dom changes here ... flushDomChanges();
Or use fastdom[1], which batches reads and writes to reduce layout thrashing.
Well I thought that is why there is requestAnimationFrame.
Re:Netflix Likes React
by jonathancreamer on Wednesday January 28, 2015 @05:50PM
(#8963070)
Great explanation.