8 Handling events in React
This chapter covers
- Reacting to user input using events
- Handling event capturing and bubbling
- Managing default event actions
- Attaching event listeners directly to the DOM
Events are the way that users interact with a JavaScript web application. Events can be caused by mouse movement or clicking, touch interface clicks and drags, keyboard button presses, scrolling, copying and pasting, as well as indirect interactions such as focusing and unfocusing elements or the entire application.
So far, we’ve created React applications with very little user interaction. We’ve handled clicking a button here and there, but not really talked in depth about how the click event works, and how we as developers handle it. We’re going ...
Get React Quickly, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.