JSFiddle - React, Tailwind, and code Playground

HTML

<div id="parent">
    <div class="child">
    </div>
</div>
<input type="button" value="1- Remove Elements" id="remove"/>
<input type="button" value="2- Generate" id="generate" />

CSS

#parent {
    border: solid 1px black;
}
.child {
    width: 50px;
    height: 50px;
    background: blue;
    -webkit-transition: background 4s;
    -moz-transition: background 4s;
    transition: background 4s;
}
.newChild {
    background: red;
}

JavaScript

var clone = "";

$(window).load(function(){
     clone = $("#parent").children("div").clone();
     $("#parent").children("div").addClass("newChild");
});

$("#remove").click(function(){
     $("#parent").children("div").remove();
});

$("#generate").click(function(){
    $("#parent").append(clone);
    $("#parent").children("div").addClass("newChild");
    
});