JSFiddle - React, Tailwind, and code Playground

HTML

<button>Add class to p</button>
<p>p is here</p>

JavaScript

$(function(){
    $('button').click(function(){
       $('p').addClass('red');
        
        
    });
    
    $('body').on('click','.red',function(){
        alert(''); // doesn't work?
    });
});