JSFiddle - React, Tailwind, and code Playground

HTML

<p>This is a <b>bold</b> paragraph.</p>
<button>Add</button>

JavaScript

$("button").click(function(){
    $("p").text(function(i,origText){
      return "Old text: " + origText + " New text: Hello world! (index: " + i + ")"; 
    });
  });