A synthetic event system gives React event handlers normalized event objects, so browser differences do not leak into everyday UI code. React follows the standard HTML event model while coordinating events without adding a separate listener to every individual DOM node. section 8.2.3
Synthetic events provide a familiar, shared API:
- Common properties include .type and .target. section 8.2.3
- Common methods include .preventDefault() and .stopPropagation(). section 8.2.3
- Specialized events add properties such as .pageX and .pageY. section 8.2.3
- Use .nativeEvent when application code needs information from the underlying browser event. section 8.2.3
Normalized mouse-wheel data
Browser implementations may expose horizontal wheel movement as .deltaX or .wheelDeltaX. React’s synthetic mouse-wheel event presents the value consistently as .deltaX, allowing the handler to use one property. section 8.2.3
Figure 8.4 React doesn’t add a listener on the individual node, but listens to any event on any node, unlike native DOM listeners.
Use the figure to compare React’s coordinated event handling with native listeners attached directly to individual DOM nodes. section 8.2.3
