JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" data-test="some text">click me</a>

JavaScript

function getAnchor() {
    console.log($(this).data('test'));
}

$('a').on('click', function(e){
    e.preventDefault();
    getAnchor.call(this);
});