JSFiddle - React, Tailwind, and code Playground

HTML

<button id="button" data-name="Mathew" type="button">click</button>

JavaScript

var button = document.getElementById('button');

button.onclick = myfunction;

function myfunction() {
    var name = this.getAttribute('data-name');
    alert(name);
}