JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" data-test="some text">click me</a>
JavaScript
function getAnchor(el) {
console.log($(el).data('test'));
}
$('a').on('click', function(e){
e.preventDefault();
getAnchor(this);
});