JSFiddle - React, Tailwind, and code Playground

JavaScript

(function callback() {
    console.log('foo');
    
    if (true /* or whatever*/) {
        setTimeout(function () {
            callback();        
        }, 1000);
    }
}());