JSFiddle - React, Tailwind, and code Playground
HTML
<div class="btn-group">
<button type="button" class="btn j-publisher-toggle active" data-type="0">Частное лицо</button>
<button type="button" class="btn j-publisher-toggle" data-type="1">Предприятие</button>
</div>
JavaScript
$('.btn-group button').on('click', function() {
if ($(this).hasClass('active')) {
return;
}
$('.btn-group button').toggleClass('active');
});