Podcast Lookup

Event Handling in React JS Explained | Master User Interactions in React

ReactJS Developers Podcast

  • December 3, 2026
  • 40 min
  • Episode 25
Episode page
About this episodeEvent handling is an essential part of building interactive React applications. It allows your application to respond to user actions such…
Event handling is an essential part of building interactive React applications. It allows your application to respond to user actions such as button clicks, form submissions, keyboard input, mouse movements, and other browser events.In this episode, you'll learn how event handling works in React JS, how to attach event handlers to components, and how to execute functions in response to user interactions.We'll explore practical examples that demonstrate how React handles events and how you can use event handlers alongside component state to create dynamic and responsive user interfaces.Whether you're new to React or improving your frontend development skills, this tutorial will help you understand one of the most important concepts in React development.What You'll Learn
  • Understanding event handling in React JS.

  • What React events are and how they work.

  • Handling button click events using onClick.

  • Working with input and change events using onChange.

  • Handling form submissions with onSubmit.

  • Passing functions as event handlers.

  • Passing arguments to event handler functions.

  • Understanding the React event object.

  • Using preventDefault() to control browser behaviour.

  • Managing user interactions with React state.

  • Common event-handling mistakes and best practices.

Who Should Watch?
  • Beginners learning React JS.

  • JavaScript developers transitioning to React.

  • Frontend developers building interactive web applications.

  • Students practising React fundamentals.

  • Anyone interested in mastering React user interactions.

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

Event Handling in React JS Explained | Master User Interactions in React

00:00—
  1. Speaker 1

    Now we are going to learn about event handling and it will be very easy for you because you have also studied event handling in javascript. I have definitely studied it and I have studied it in so much depth that I don't know what to say. Definitely you must have read it. That's why you have come here. And if you haven't read it, then don't worry at all. Because there are a lot of easy things here. And it's a little different too. So definitely if you have read it there, then you should also see it here once again. Because you will get a lot of different things. And if you have read it, then it will be fun. And if you haven't read it, then it will be fun too. Because we have done small events till now. So you will understand what the event is, how it happens. If you are not coming, then I will definitely tell you from the start. And wherever I say that this lecture, now see if you haven't done JavaScript, then it's not a problem. I will recommend you some things in the future. Do that carefully. It will be fun. So in event handling, first of all, you understand what an event is. You know what an event is, right? No? Not any bad incident, why would we call it a bad incident? Any incident that is happening, like you are slapping someone, you are slapping someone, okay, you are abusing someone, or you are writing something, you are shaking something, in shaking, I am talking about the mouse, if you are moving the mouse, you are leaving, so all these things are your events, definitely. Now here, if we talk about computer screen, computer screen, I have talked a lot about it, If we talk about software, then what can you do in a software, a website or a web app? You can definitely do some work by clicking on the mouse. We have seen button click, button click, on click, etc. That is the same event. So we can put a click event, then we can put a mouse move event in the mouse, that the mouse is moving. We will see all the things now. We will see most of the things in the projects. It is not that I will remove you from all the events here. Then comes mouse leave, mouse enter, mouse over. So many events can come in this way. For form, you will know that an onSubmit event comes here. You have also done all these things in normal HTML, CSS, JavaScript. So you definitely have an idea of the event. And if you don't have this idea, then how did you come so far without knowing? So, let's see how we will do event handling. You will have some idea about it if you have done it in javascript. And if you haven't done it, then you know that the previous react playlist is running. So, we have handled the event in the previous projects. So, you will have some idea about it. Let me show you the most basic event handle. I come here and make a simple button. What I have made? Button. I will give the name of the button, not the name. Click me. Look carefully here. I come here. You must be seeing a button below. As soon as I click the button, something happens when I click. What? Did something happen on clicking? We clicked. We performed an event. But we haven't handled the event. Understand my point carefully. Here, see, neither anything is happening on the console, nor anything is happening on the screen. I am clicking. Oh, man, see this. Proof. I am clicking, but nothing is happening. So, our event is performing. We are not handling the event. So, what will we do to handle the event? Which event is happening now? Click event is happening. So, I will click on this button. I will put onclick and I will pass that function in it which I have to perform on clicking. You can make any simple function here. I will give some greet name of this function and here I will say CLG. Not CLG, I will do alert. It is not good to do CLG again and again. So, I will do alert. In alert, I will say hello. Anush Kumar Lal. I will pass this in the greet function. I have told you to run the greet function on click. As soon as I click, it will run the greet function. This is very basic. I know I am going very basic. But the level will increase slowly. As soon as I click, now we have handled the event. We handled the event and ran a greet function which is saying Hello Manus Kumar Lal. So we handled the event. So we are going to understand the event handling here. What are the things that you have to keep in mind in React. Beginners make mistakes. What is different from HTML? What is different from JavaScript? And there are some in-depth things that may be asked in the interview or not. I have not been asked this yet. I will tell you the reason why it is not asked and what I am talking about. Let's see this first. HTML vs React Element. If you have worked in HTML, then the JavaScript we used to write inline was written in this way. On click and whatever alert you have to do here, you have to call the function, then only the name of the function was written here and your work was done. I will not explain this by making HTML and Javascript file. This is very basic. So, in HTML, something like this used to happen. Look carefully here. We used to call it attribute. On click. We are using inline Javascript here. On click. And here C is small. Look carefully. C is small. It is equal to. In string, whatever work we have to do, we have to allow it, we have to console it. Or we can write the name of the whole function. If we write sum here, then it will find the sum function and execute it. So, this happens in HTML. What is different in React? In React, we are doing the inline work here also. But here, C is in the camel case. Pay attention to this. Here is onclick and here is C in onclick. Similarly, all other events will be in the camel case. So, just keep this in mind. It is a small thing that you have to write in the camel case whatever you have to write. After that, you have to pass the function here. And definitely, you know this syntax, why curly braces are used to write JavaScript here. So, we don't have to put curly braces here, we have to give our function in it. That's it. What we have to do is to give our function in it. Alright. As we have done here, we can put this whole function in place of this. Either you can put the function like this or you can give reference to the function. Okay. Rest, you don't have to call, I will tell you that later. So, you must have understood this much. This was very basic. Very basic. Pass a function reference, not a string. React event works across browser using synthetic event. Now, I will clear this concept of synthetic event properly. In interview, you may also be asked about synthetic event. So, I will clear it for you. But now, let's go to the flow. Event handler basics. Handle basic events like click, change, on, submit. You can do all this. Like I told you click event. Similarly, on change event happens. You must have read on change. If you have made a project with javascript till now. So for which we use on change? Definitely for input box. So if I make input box here. Wait a minute. Input. Ok. So if I want some values in the input, then what will I put here? I will not put onclick. Because I am not performing any click away in the input box. See here there will be an input box. It is not visible. That's a different matter. So what will I do here to show? I will give it border and border-white. Even then it will not be visible. So here is our input box. The text is not visible. Let's give it placeholder so that it will be visible. Placeholder, enter name. Enter name is coming here, alright. So, what we are doing here? Click event is not performed here. Think for yourself, what will be the click event here? If you click on the button, what will be the click event here? Nothing will happen. If you want to do something on click, then you can definitely do it. But, what we have to do here? On change. As soon as there is a change in the input, we have to see whether the change is happening or not. Alright. So, how will we do that? So, definitely here, as the name is, write on change. And look carefully here, it is C capital. In camel case. So onChange. Now pass any function here. Like if I do something with alert. So this is blocking in nature. So we don't do blocking in nature. We do console. So here function. Give something in function. Handle input box. Handle input box. And here do CLG. Input changed. Alright. And here handle input box function. Pass it. Now look carefully what happens here, error comes, no error does not come, we have done something wrong, handle input box, alright, ok, here we have missed, ok, we had written the syntax wrong, so now as soon as I type here, see, once I typed, the input changed, alright, again I typed, the second time the input changed, the third time I typed, sorry, the fourth time I typed, the fourth time the input changed, Input is changing, you will see how to take the value. As I type, the input is changing. I changed it 60 times. This is 61. Okay. So, you understood this much. In the same way, ONSUMMIT is different. Different are your handlers. Sorry. Different are your events. You can definitely go and read in documentation. And if there is a problem in reading documentation, then definitely you can watch the lecture on JavaScript. In JavaScript, lecture in JavaScript. Which lecture was it? DOM Manipulation. DOM Manipulation. In the Dom Manipulation lecture, the event portion is at the end. So, you can see the last hour of the event here, the event will be cleared. And then there is the event life cycle, if you want to go in more depth, then I have also studied the event life cycle from the point of view of the interview. So you can definitely see that too. So different events will be cleared for you. Rest, we will make projects now. So we will make projects, so almost all the events will be covered. So don't worry. As the events will come in the project, I will keep telling you. If you go practically, it will be more fun. Theoretically, I am telling you one by one. On click, on change, on submit, on most enter, on most leave. It won't be fun. Is it or not? So here, on change, as I told you, on submit also happens. On submit, you may also have. You must have read it. OnSubmit. Haven't you read it? Let me tell you. Basically, onSubmit is done in the form. So, in the form, let's say we have made an input box here. And after that, we have made a button. In the input box, we give placeholder something here. Enter email. And we give submit in the button. Alright. So, now what to do when onSubmit is done? So, where do we put onSubmit? In the button or in the form. So definitely we put it in the form. On submit. On submit. What we have to do is we have to do handle input box here. We run the same function. We will make a different function now. So, we have run this function in onSubmit. So, let's see what happens when it is submitted. So, we will come here and reload. So, this is our form. We will write something here. As soon as we submit. So, see, the input has changed. It had come but it has gone. It has moved. Look carefully. Look carefully. Don't look here and there. I have typed here. As soon as I will submit, the submit button will run and the handle input change will be run. So, what will happen after submitting? Look carefully at this point. I submitted and there was a change in the input. But because the page was reloaded, it was removed. Let me show you again that the page was reloaded. See, the page was reloaded. There was a change in the input, but because the page was reloaded, it was removed. So, why was it reloaded? Definitely, it is the default behavior of the browser which can be prevented. I will tell you that just now after two slides. 1-2 slide means this, this is our notes, I am calling it slide. So I have taken 1-2 slides ahead, so definitely I will tell you all those things that how you can prevent the default event. And how you can stop the propagation, all those things. So whatever you type here, so the default behavior is that it submits and reloads the page. Okay. Basically, it's sending in the backend. So, you won't understand all that. So, let it be. For now, it's reloading. So, to avoid that, we have to do something which we'll see in the future. So, all these events are getting cleared. Definitely, they're getting cleared. It's very basic. That's why I'm going fast. Right? It's very basic. We've read it so many times. We've read it in the React playlist. In JavaScript, definitely, in depth. So, now accessing event object. Now, what is this? What is this? This is interesting. You have to know this. What is event object? Look, should I clear all these things? Let's not clear them. Let it be like this. Again, I make a button here. And in button, I write click. And here, in on click, I will run a function. And I give the name of the function something like this which I can use in everything. Handle input box looks like this that input box is handling. So, I give the name here. Now we will run this testing function on clicking. As soon as I click, it is coming. Now let's see what is our event object. By default, whatever event is being performed on this button, even if you are clicking or whatever event you are performing, even if you have put on click, then click will be the event. So all the details related to click, all the details of the event, you are getting in this function in the parameter, you have to receive that parameter here. Give any name of the parameter, give E, give event, give object, okay. So, for now I am giving E and let's see what I am getting. By default you are getting E. You don't have to think from where it came. You have put onclick event on onclick event. So, there must be a lot of things happening on clicking. what is the value of it, on which it is clicked, what is the target, there will be a lot of details in it, so if we want those details, then we are getting those details from E here, that is, whatever parameter you give here, give E, give F, give G, here basically you are receiving an event. So, you can receive it as you want. But now we need the details of the event. So, we will receive the event here. So, let's reload it. As soon as I click here, see this. There are a lot of things coming here. This is an entire object. There are a lot of things coming in the object. Detail, event phase, etc. There are a lot of things. There are a lot of things. There are a lot of things. There are a lot of things. There are a lot of things. There are a lot of things. There are a lot of things. There are a lot of things. So there are many things, you need inner text, now I want a target, I want to see a target. So how will I see? I will do event.target here. So, I will get the target. I will reload. As I clicked, I got the target. So, as we are clicking here, our target is being clicked here. Whatever the target is, if we click on the button, then our button is targeted. So, we can see that here. So, we can remove a lot of details from it. Now, it depends on what details you need. Definitely, we will need. For example, I can give you an example right now. As you want to handle the input box here. I will give placeholder here otherwise it will not be visible. Enter name and end. I have put on change here. I have put the same testing in on change. Now from here I can see CLG event.target. It was written earlier also why I changed it. So, I am writing something in the inter name. So, I am getting event.target. Now, I want the value inside it. So, I can write event.target.value and access that value. Look carefully. I wrote A. Okay, A is coming here. One minute. Let me remove it. Let me comment on it. Okay. So, let's reload. Look here. I wrote A. A is coming. B is coming. C is coming. I mean, we are able to get the details inside it. And that too so easily. So, we have put onChange testing and we are getting the value from event.target.value. Now, all these things will be very useful in the future. As you will go in projects and you will not get to learn a lot of things. Now, in one lecture, no one will tell you because there are a lot of things. And that is not written. When it comes to practical use, then you understand. So now you know what is an event object and you can do whatever you want to do with it. You will get a lot of details and you can do whatever you want to do with it. So this was our accessing event object and all these things were also in javascript and I had read a lot in detail. Because it was the core and I am repeating it here. Even if I didn't tell you, I am repeating it because some things are different and beginners have problems. They get stuck in a lot of things. I will tell you where they get stuck in the future. So now see what is synthetic event. So, this is the same thing that is different from our normal event handling in HTML, CSS, and JavaScript. React uses our synthetic event. Let's understand that. Event handling in React follows a similar pattern to standard JavaScript. It is similar to standard javascript. You can see that we are doing event handle in the same way as we used to do in normal javascript. But with some key differences. Such as using synthetic events. What does React use? Synthetic event. I will tell you that now. Why does it use synthetic events? What happened? Is it not working? There is a problem in the paint tab. I was telling you that synthetic events are used for cross browser compatibility. That means that you worked on one browser and if the same event is not working on your other browser, then what is the benefit? So for cross browser compatibility, your synthetic events are used here. And providing consistent event handling across different elements and browsers. Whether you use it on any browser, and browser when you handle event in react like clicking a button or typing in an input box react wraps the native browser event in something called synthetic event So, your event is an object, nothing much, a wrapper is placed on it, which we call synthetic event. Now, in synthetic event, there are a lot of things internally, but we don't have to go into that much detail. This synthetic event ensures consistent event handling across different browsers, we got to know this. There was a problem here. It was very important to know about synthetic event to know about it. But now there is no problem in react 16 and later version this problem is no more. So now there is no such problem. I don't think you will be asked about synthetic event in depth. But you should know a little bit which I will tell you. Here, the concept of polling used to be there. When you handle the event once, the handler used to pull the event once and go back to the loop. And the same synthetic event used to be used again. Just for performance. React pulls the event for performance. If you don't have pen tab then how will I explain properly. Suppose this is your event. This is your synthetic event. You have run this event handler. Handler means a function. You have run this event. This event has been formed. You have used the event object. Now this same synthetic event will be pulled again. And there event and target will be null. So that you can use it again. So this was the reason that in async code, if you make an async function, then your e.target.value was getting null. Did you understand me? The same synthetic event was pulled back and event.target.value was nullified. So that you can use it again and don't have to generate it again and again. Earlier in async code, you were getting null in e.target.value. But now there is no such problem. If you make the same function now, then you will not get anything like this. I will show you how to do it. Set timeout. Set the time to 1 second. And do CLG to event.target.value. And here we have put the input. Let's change it to onChange and reload it. I wrote A and A is coming after 1 second. It is coming late because we have set timeout but it is coming. It was not like this before. Because of pool, the concept of pooling used to use the synthetic event again. So to use it again, it was null. So it was null and all these things were there. If you want to go to the quality app, you can go to the documentation and read it properly. There is no problem in this. But now it works properly. Look at this. Okay, it's okay after a second, but everything is working here. The value is not null. So they have definitely solved this. So, I thought it was worth knowing. Although, I don't think all these things will be asked in such depth in the interview. But, again, okay, we have also known this. So, there is no problem here. In React 16 and later version, this problem is not there. Okay. After that, passing arguments to handlers. Now, how to pass arguments in handler? So, it is very easy. But, you have to keep one thing in mind here. What is that? So, I will tell you that right now. This function is also filled, comment it and make a new function here. Name it testing and something like this and make a button here. Click and on click. Now understand my point carefully here. We are passing the reference of this testing here. If I did CLG here. Hello, how are you? So, as soon as I click on this button, let's reload once. As soon as I click on this button, hello, how are you is coming. Exactly, our problem is not coming here. But, but, but, we have to pass our argument here. Definitely, suppose I want to take a name here. So, how will I pass here? We have to pass reference. Either pass reference or pass the whole function here. That means you are giving reference to it. So it will be called only when it clicks. So we have to pass reference here. And if we do it this way, then it will be called. Look, I will show you here. I did reload. See this. It has been called. It has been called before. And it is happening twice because again, you are not going. Our strict mode is on. Okay. So, here we are not getting a call on clicking, it is automatically getting a call because we have called it here. So, we don't have to call, we just have to pass a reference so that whenever we click, only then the event will be performed here. Okay, so we have to do this, but if we call, then it will be called directly here. So, we don't have to do this, but we have to pass an argument here. Now, how will we do it? So, for that, a very simple way is that you make a function here as well. No problem. You can make a function here. You are making a function, that means you are passing a reference. Now, call this function inside it. What is the problem? Call this function inside it. And give your name here. Minus. So, you will be able to see it here. Okay. So, these are very small things. Earlier also, I told you in basic lectures, but again, I repeated it. So, You must have understood it properly. So here it is doing the proper work. It is not calling by itself, it is calling by clicking. Whereas if you do it this way, direct call, then it will call by itself, it will not call by clicking. So if you want to call by clicking, then pass the reference, but if you want to give an argument here, then definitely you have to do it. You have to make a function like this. If you make a function, then this function's reference is going. So, as soon as you click, this function will run. And in this function, this function you have called, then this function will run. So, there are two functions here. Okay. Did you understand? Okay, now let's move forward. So, passing arguments to handler, here you just have to keep this thing in mind, which I have told you. Baki aage hai using state with events. Ye to humne kari liya hai, project bhi bana liya hai, to definitely iska to apko idea hai, ye set count, account, set count, kis tariye se handle karne pe state change karte hain hum log. And state mein kya kya cheeji dhyan rakhni hoti hai, state mein to pura ka pura lecture bana ho hai humare state ka. So, react, read, enders, on, set, change, event handlers, capture, the current state snapshot. Here it is using the current state. And what was the pitfall? Our state updates are asynchronous in nature. So, if you want to access the count just after the set count, then you will not get the updated value. You will get the old value. Updated value is only this one. You are working on the current state. So, I discussed all these things in great depth in the state lecture. You must have seen it. So now let's come to prevent default and stop propagation. What is prevent default and what is stop propagation? So I told you just a while ago. We were choosing from a problem. That was our problem. When we were submitting the form here. Placeholder. Enter number. Okay. Not enter number. Enter name. alright and here is a button button submit although if you don't put then by default your submit is happening so we have to put on submit here on submit and in on submit let's make a function here submit handler and here let's do CLG submit is done ok comment it out definitely So what was happening here, let's put the submit handler here, have we written the wrong spelling? submit handler, alright, here comes our submit handler, ok, so let's reload, here as soon as there is one more mistake here, we forgot to give text here, click, alright, As soon as you click on it, it will be reloaded. To prevent the default event, you will do event.preventDefault. Where do you get the event object? By default, you get it from here. So I named it event. Prevent Default will prevent the default behavior. As soon as I click on it, it will be submitted. The page has not been reloaded, it has not submitted to the database, it has prevented the default behavior and whatever you have done is coming here. So, you understood what prevent default is. Now, let's take an example of stop propagation. Bubbling, capturing, tickling, these are all things. These are all interview topics. So, definitely there is no need to repeat. The lecture in JavaScript with lifecycle is the same. in vain. Go and watch the lecture on life cycle. There you will understand what was bubbling. By default, bubbling phase is enabled. We can also do capturing. Capturing is called critic link. Event delegation etc. We have covered a lot of interview topics there. So definitely go and watch that lecture. The lecture will be called event life cycle. You will find it in the playlist of JavaScript. You can search premium JavaScript. You will find it at the top on YouTube. So you can definitely go and watch it. I will tell you a few things about stop propagation because this is our topic for now. So I made a div. This is our parent. OnClick. Let's put the parent handler here. We will make a parent handler function here. And this is our child. OnClick. Wait a minute. I wrote it wrong. OnClick. Let's pass the child handler here. And here we say click me. Okay. Click me. And let's make both of them buttons. Let's make both of them buttons. You can give buttons inside the button. Come on. Parent click. And let's do the text inside this. Child click. Okay. Child click. Alright. Now let's make a parent click handler. Function parent handler. CLG. And we will make one more function. And here CLG clicked on child. Alright. So now see what we have done. One is this button, which is our parent button. Let me document the format once. This button is your parent button. In the parent button, your text is parent click. And in the parent button, there is a child element. In which I have given child click text. And here we have put event handler child click. And on the parent button, we have put event handler parent click. If we click on parent then it should be clicked on parent and if we click on child then child handler should be run and child should be clicked on child. Let's reload. For now your button is not descending. You can't put button in button. It is giving this error. It will work but if you want to solve the error then take the div here. There is no issue here. So we have a div here, if you can't see it, then I give it here to show bg-red500 and flex-item-center. Leave all this, we don't do much style. So this is our parent. If we give padding, then it will be better understood. This is our parent. If we click on the parent, then it will show us that we have clicked on the parent. If we click on the child, then it will show us that we have clicked on the child. Clicking on the child will show us that we have clicked on the child as well as on the parent. This concept is called Event Bubbling. The event bubbles up and goes to the parent. The child was this button. As soon as we clicked on the child, the event bubbles up and goes to the parent. That means the parent also clicks automatically. If there was a parent of this, then its click would also be automatic. If there was a parent of that, then its click would also be automatic. So this bubble keeps going from parent to parent till the end, till the root parent. Okay? So now who is the root of this? It's the body. It will go to the body in HTML. Right? It's the main. If you have written something in the main, it will go there. So all those things here are the same as it was happening in JavaScript. So it's the same. There is no different concept here. As soon as you clicked on child, it's going to parent as well. So if you want to stop going from child to parent, then you have to do stop propagation. It means you have to propagate. Stop it there. So I will come here and in child I will say In child I will say e.stoppropagation. Let's reload. I clicked on child and now e clicked on child. Why? Because here we have done e.stoppropagation. So here it is saying that don't go to parent. So it has done the work of child and it has not gone to parent. Now here is the capturing phase. Basically, first of all, it comes from the parent to the child and then goes from the child to the parent. So whatever is coming from the parent to the child, we call it tickling, we call it capturing. And then whatever is going from the child to the parent, then we call it bubbling. So here we saw the bubbling, the rest of the capturing, etc. If you want to see everything in depth, then I am telling you again and again. It is very interesting, I told you in a very interesting way. You can go and check it out. So I told you that you can stop further propagation from stop propagation. For example, if there was a bubbling here, we were clicking on the child, it was also going to the parent, so we stopped it from going to the parent. So we stopped propagation in the child, it will not go to the parent. If there was a parent of the parent, then we would have stopped propagation in the parent, but it does not go to the parent. So it depends on you, if you stopped it in the child, then it will not go to any parent. So, you have to keep all these things in mind and watch in detail. Definitely, you can go and watch. Alright. If you are making a function here, you have to pass an argument here, then how will you do it? We will definitely use this syntax to pass the argument because we can't call directly. So if you want to pass an argument, you will make a function here and call the function inside it. But now we will not get E. Will we get E? No. If we click here, we will not get E. If we don't get E, we won't get stop propagation. How to give E? By default, you will get E here. You can send E here. If you send E here, you will get E here. E means event object. We clicked. It is working perfectly. That means you are getting E. Alright, if you want to send any other argument, you can definitely send it here. For example, I want to send my name here. I want to receive here. You can do it here. There is no problem here. Okay. These are small things, but we get stuck a lot of times. Right? So, you have to keep this in mind. Let's move forward. Your prevention and stop propagation has been defaulted. So I have told you all these things that bubbling is here, you can stop it. There are many concepts related to this. Your event delegation also comes here, which is asked to you in interviews. So now if you say that all these are part of react, then the interviewer will drive you away. All those come in your java script. Even the whole react is your java script. So, the one who has strong Javascript, he must be able to understand that this is the part of Javascript, there is no React. There is no connection between React and Javascript. In React, it was just that people are writing like a camel and synthetic event. That's it. And the syntax was a little different. That's it. Okay. What are the common beginner mistakes? You immediately call the calling handler. If you call, you will get a direct call. You will definitely get a call even if you click. You don't have to make this mistake here. You have to pass a reference here. And if you need to call here, then make another function here and call in it. In total, you have to pass a reference here and not call. So use arrow function. This will solve you. Losing event object, react, pull, synthetic event I told you. So there is no need to solve this. React 16 and 16 plus whatever version it is. It is working fine in all. Till now there is no problem. Alright. Forgetting e.preventDefault. Where to use e.preventDefault? This is definitely your idea. You have done java script. I have given an example that if you want to prevent default behavior then definitely you have to use e.preventDefault. There are other things like if you want to stop pop-up, you have made PWA, progressive web app and there is a pop-up that you know to download, you have to prevent that pop-up and use it by capturing it by yourself. So you can stop all those things by prevent default there. Call it inside handler. Right? Okay, you have to call inside the handler, definitely. Otherwise, you will not get event object. You will get event object only if you handle event. And that event object, i.e. E, is the prevent default inside. Now, you can give the name of E anything. Event, E, object, anything. Using state directly after set state. Now, this is the state concept which I have told you. State update is sync. So, for this, you can use callback etc. You can use use effect etc. Callback, I have told you. Hmm. Use. Okay, this is talking about normal callback, not use callback. Okay, normal callback or use effect, etc. you can use here. So, I have told you all this in the state itself. Right? You got the idea. Not stopping event bubbling both parent and child trigger. If you don't do stop propagation, then by clicking on child, it will also click on parent. Right? So, if you want to click on child, click on child. If it doesn't propagate on parent, then you definitely have to do stop propagation here. So, these were some mistakes that I thought that all these mistakes can happen to you. I have noted them down at one place. explained all the things to you in detail. But, my recommendation is that DOM manipulation video at least and I am saying this from the starting that if you are learning React, then also learn JavaScript. The stronger the JavaScript will be, React will become stronger. JavaScript is directly proportional to React. The more JavaScript, the more React. Even React is nothing, it's just JavaScript. Okay? So, if you want to practice life cycle, you can go and see. Thank you so much. Okay, that's it. See you in the next lecture. Till then, bye-bye.