Check out example codes for "javascript eventlistener". It will help you in understanding the concepts better.

Code Example 1

event.preventDefualt()

Code Example 2

const element = document.querySelector(".class__name");

element.addEventListener("click", () => {
	console.log("clicked element");
});

Code Example 3

document.addEventListener('click', () => {
    
});

Code Example 4

element.addEventListener("click", function(){ 
   element.innerText = "something"; 
});

Code Example 5

document.getElementById("myBtn").addEventListener("click", function(){
  document.getElementById("demo").innerHTML = "Hello World";
});

Code Example 6

let element = document.getElementById("xyz");
//	Event Listener
element.addEventListener("click",  myFunction);

// Call Function On Click
function myFunction() {
  alert("Hello World!");
}

Learn ReactJs, React Native from akashmittal.com