JSFiddle - React, Tailwind, and code Playground

by thesystemrestart

HTML

<div id="text_wrapper"></div>

JavaScript

var texts = ["Text 1", "Text 2", "Text 3", "Text 4"],
        div = $("text_wrapper")
    
    
    function runAni(texts){
        $.each(texts, function(index, text) { 
            div.html(text).fadeIn('fast', function() {
               $(this).fadeOut();
            })
        });
    }
    
    runAni(texts);