liveBook · Manning

Type property

As explained in React Quickly, Second Edition

A type property is an event-object property containing the type of event that occurred.

The type property is an event-object property that identifies which event occurred. Read it as evt.type inside a React event handler. section 8.2.2 section 8.2.3

Distinguishing events in one handler

Assign one handler to both onMouseEnter and onFocus, then inspect evt.type to determine whether the user moved the mouse over the input or reached it with the keyboard. section 8.2.2

React synthetic events follow the standard event API model. Along with type and target, they provide shared methods such as preventDefault() and stopPropagation(); specialized event types add their own properties. section 8.2.3

How React Quickly, Second Edition covers it

How deep it goes
Defines the property and demonstrates event discrimination, but defers comprehensive event-property details to documentation.
Examples
Uses one handler shared by onMouseEnter and onFocus to identify the triggering event.
What it assumes
Assumes familiarity with React event handlers and event objects while introducing the shared type property directly.
What you can do after
Apply it to distinguish different event kinds inside a shared React handler.
How it connects
Connects event objects with React synthetic events, event handlers, and the target property.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of React Quickly, Second Edition. The section links point to the parts of the book it draws on.