JSFiddle - React, Tailwind, and code Playground

HTML

<div id="center_content_box">You can use completion handler to set your div's new text after animation finished.</div>
<input id="try" type="button" value="Try it">

CSS

div{
 background-color:gray;
 width:100px;   
 overflow:hidden;
    
}

JavaScript

$('#try').click(function(){
var data ="Lorem ipsum dolor sit amet "
    $("#center_content_box").slideToggle(1000, function(){
 $("#center_content_box").empty().html(data).slideToggle(1000);
 });
});