JSFiddle - React, Tailwind, and code Playground
HTML
<a href="https://google.com">1</a>
<a href="https://google.com">2</a>
JavaScript
let links = document.querySelectorAll("a")
for(link of links){
link.addEventListener("click", function(event){
event.preventDefault()
event.stopPropagation()
console.log("do stuff here")
})
}