automatic batching

React groups several state updates made in the same event or task into a single re-render.

In more detail

Since React 18 this happens everywhere, including inside promises and timeouts, not just in event handlers. It avoids wasted renders and prevents the screen from showing half-updated state. DOM changes are batched the same way and applied together in the commit phase.

Related terms

Taught in

References