JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" onclick="return check(this);">link here</a>

JavaScript

function check(link) {
    if (link.className != "visited") {
    alert("new");
       link.className = "visited";
       return true;     
    }
            alert("old");
    return false;
}