Click Listners in React - add event listeners to the application. Click is one of the event listeners in React.


Add onClick Listner

  • Basic click listner- calling once only on page load only
    • Add Click event at top
    • Issue: Now, when this button gets rendered, JSF is going to kick off this add to do button automatically.

 

 

 

  • Basic click listner- calling once only on click on on page render
    • We don't want this event working when page is rendered. We only want the ad to do button to go off when someone clicks it, thus we need to make sure it is a pointer.

 

 

 

  • Alter addUser to add new user in our Array
    • This only increase our array and log and actual listing on page is not increased

 

 

 

  • Create and Class anonymous function call by doing parentheses, arrow function brackets, 
    • Call on each click

 

 

 


Related Question