ipi.
← React Field Guide

Concept 6 of 11

Events

✦ Tap any highlighted term to learn more

React handles using camelCase names attached directly to elements: onClick, onChange, onSubmit, onKeyDown. You pass an handler — a — as the value.

The handler can be defined inline or as a named above the return ment. Named are easier to read when the logic gets complex. Inline arrow are fine for simple one-liners.

React passes the browser's native to your handler automatically. You access it as the first argument — by convention named e or . This is the same you'd get in vanilla .

A common mistake: calling the instead of passing it. onClick={handleClick} passes the reference. onClick={handleClick()} calls it immediately on every . Always pass the reference, not the call.