React TutorialLesson 26Free preview
React Events
This lesson is part of React · All levels
Summary
React provides an event handler in the form of camelCase attributes such as onClick and onChange that accepts JavaScript functions. On a functional component, you simply pass the function or arrow function to the event attribute. The event object used is a synthetic event from React so it is consistent across browsers.
Key points
- The name of the event is written camelCase like onClick and onSubmit
- The handle is a function, not a string of function names
- Arrow function is used when trying to pass on additional arguments
- The event object is pooling and has been deleted since React 17.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.