What happens when you call setState?

August 02, 2018

When you call setState, React takes the data you passed in and merges it into the current state of your component. This kicks off a process to update the DOM in the most efficient way possible.

To perform this update, React renders a tree of components in the virtual DOM, diffs the tree against the previous one, and updates the actual UI where necessary.

Want more?

My newsletter sends rarely. It's where I share updates on the best of my writing: introverted entrepreneurship, esoteric mindset tips, notes from great books, and automating businesses as a solo-owner so they run by themselves. Want to join?

Subscribe