JSFiddle - React, Tailwind, and code Playground
CSS
.gallery-container { width: 100px; height: 0px; background: red; transition-duration: .4s }
.gallery-exp { height: 400px }
JavaScript
var dyna_gallery = document.createElement("div");
dyna_gallery.className = "gallery-container";
document.body.appendChild(dyna_gallery);
setTimeout(function(){
dyna_gallery.className += " gallery-exp";},0)