From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Handling user events

Handling user events

Welcome back. In this video, we will discuss about handling events. Events uses camel case notation. That means, the first letter is going to be small and then after that every word is going to be start from capital letter. We passes a function reference to the onClick, onChange and all the other events. That's an example of how we are handling on-click event. We are passing on a handleClick function reference and inside that function, we can do whatever we want to perform on that event. Here are the list of some of the common events on-click, whenever you click on an element, On change, whenever user is going to type something from the keyboard. On submit, whenever user submits a form. And on mouse over, whenever user hover over any of the element. Here is one of the event example where we are going to update the state of an input field. And as you are going to see that as soon as we are going to update the state, we'll see real-time updates. Here is the sample code for it. We have…

Contents