What is React batching and how does it work in React 18?
Updated Apr 23, 2026
Short answer
In React, batching is a performance optimization where multiple state updates are grouped together into a single re-render instead of triggering multiple re-renders.
In React 18, batching was improved to include automatic batching for all updates, not just those inside React event handlers.
Deep explanation
What is Batching?
Normally, every state update could trigger a re-render. Batching means React collects multiple updates and processes them together in one render cycle.
This reduces:
- unnecessary re-renders
- wasted computation
- UI flickering
---
Before React 18 (limited batching)
React only batched updates inside React event handlers.
Example:
function handleClick() { setCount(c => c + 1); setFlag(f => !f);}👉 These are batched (single re-render)
But outside React events:
setTimeout(() => { setCount(c => c + 1); setFlag(f => !f);});…
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro