JSFiddle - React, Tailwind, and code Playground

by platonfedr

HTML

<div class="ui button">
  Follow
</div>

CSS

.ui.button {background: #EEE; padding: 5px; width: 100px; text-align: center;}

JavaScript

$('.ui.button').on('click', function() {
    if ($(this).hasClass('following')) $(this).removeClass('following').text('Follow');
    else $(this).addClass('following').text('Following');
});