Measuring and patching phase for React components

May 1, 2015 16:42 · 109 words · 1 minute read

On the latest episode of JavaScript Jabber, Amit Kaufman and Avi Marcus talk about how your web app performance is killed if you interleave your reading and writing from the DOM. For their now React-based app, they needed to measure certain elements for their layout work. Their solution sounds clever: components specify what information they’re going to need and they batch up all of the DOM reads and do them all at once and then they do all of the adjustments that come as a result of those reads all in one separate pass. This minimizes the amount of churn and recalculation that the browser needs to deal with.