SyntheticEvent
The event object React passes to your handlers, a wrapper around the browser native event that behaves the same in every browser.
In more detail
It has the familiar fields and methods such as type, target, stopPropagation and preventDefault, and exposes the original browser event as nativeEvent. Since React 17 the object is no longer reused between events, so you can keep a reference to it safely.
Example
A click inside a portal still bubbles to handlers on the component that rendered the portal, because React bubbles synthetic events along the component tree.Related terms
- event handler — A function that runs when something happens to an element, such as a click (onClick) or a key press (onKeyDown).
- native event — The original event object created by the browser, which React wraps in a SyntheticEvent.
- event delegation — Handling events for many child elements with one listener on a shared ancestor, using event.target to find which child was involved.
- event pooling — An old React optimisation, removed in React 17, that reused one event object for many events and cleared it after each handler.
Taught in
- Overlay Architecture: Portals, Stacking Contexts & Backdrops — Design Systems & Component Engineering
- Diffing Algorithm: Element Type Shifts And Subtree Tear Down — React 19 & Modern Component Architecture
- SyntheticEvent System: Event Delegation in Modern React — React 19 & Modern Component Architecture
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture