JSFiddle - React, Tailwind, and code Playground

HTML

<p id="element-1">Old text</p>
<p id="element-2">New text</p>

<button>Show new text</button>

CSS

#element-2 {
    display: none;
}

JavaScript

$('button').on('click', function() {
    $('#element-1').fadeOut(1000).promise().done(function() {
       $('#element-2').fadeIn(500);  
    });
});