JSFiddle - React, Tailwind, and code Playground

JavaScript

var timeOutId = 0;
var ajaxFn = function () {
        $.ajax({
            url: '/echo/html/',
            success: function (response) {
                if (response == 'True') {
                    clearTimeout(timeOutId);
                } else {
                    timeOutId = setTimeout(ajaxFn, 1000);
                    console.log("call");
                }
            }
        });
}
ajaxFn();