JSFiddle - React, Tailwind, and code Playground
HTML
dfghdfghd
JavaScript
var notifyState = function(state,fn) {
setTimeout(function () {
console.log(state);
if(typeof(fn)=='function'){ fn(); }
}, 5000);
};
notifyState('State1', function(){
notifyState('State2');
});