JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test" id="div_1">first div</div>
<div class="test" id="div_3">second div</div>
<div class="test" id="div_2">third div</div>
JavaScript
$('.test').click(function() {
var divId = $(this).attr('id');
alert(divId);
});