React uses Synthetic Events to provide a consistent, efficient, and predictable event system across all browsers—on top of native JavaScript events.
🔹 What Are Synthetic Events?
Synthetic Events are React’s wrapper around native browser events.
<button onClick={handleClick}>Click</button>
handleClick receives a SyntheticEvent, not the raw DOM event.
🔑 Why React Introduced Synthetic Events
1️⃣ Cross-Browser Consistency
Different browsers handle events slightly differently.
✔ React normalizes events
✔ Same behavior in Chrome, Firefox, Safari, etc.
2️⃣ Performance Optimization (Event Delegation)
React attaches one event listener at the root, not on every element.
✔ Less memory usage
✔ Faster event handling
✔ Scales better for large apps
3️⃣ Unified API
Synthetic Events provide a common interface:
e.preventDefault();
e.stopPropagation();
e.target;
Works the same for:
- Mouse events
- Keyboard events
- Touch events
- Form events
4️⃣ Integration with React Lifecycle
Synthetic Events work seamlessly with:
- React state updates
- Batching
- Concurrent rendering
- Reconciliation
Native events don’t integrate this tightly.
5️⃣ Controlled Event Flow
React controls:
- Event propagation
- Priority
- Scheduling
This enables features like:
- Automatic batching
- Concurrent rendering
- Predictable updates
⚠️ Important Note (Old vs New React)
Earlier React versions pooled events (event properties became null after use).
From React 17+, event pooling is removed, but Synthetic Events still exist.
🧪 Native Event vs Synthetic Event
function handleClick(e) {
console.log(e); // SyntheticEvent
console.log(e.nativeEvent); // Actual DOM event
}
🎯 Short Interview Answer
React uses Synthetic Events to provide a consistent, cross-browser event system with better performance through event delegation and tight integration with React’s rendering lifecycle. They abstract browser differences and enable optimized updates.
⭐ One-line summary
Synthetic Events make event handling consistent, faster, and React-aware—beyond what native events provide.