JSFiddle - React, Tailwind, and code Playground
HTML
<button id="id1" onClick="handleclick(this.id)">Button1</button>
<button id="id2" onClick="handleclick(this.id)">Button2</button>
<script>
function handleclick(id)
{
alert(id); //here is your id
}
</script>