JSFiddle - React, Tailwind, and code Playground

JavaScript

function showLoading() {
    $("body").html("loading...");
}

function heavyCrunch() {
    console.log("heavy crunshing emulation started...");
    setTimeout(function(){
       console.log("heavy crunshing emulation completed.");
        $("body").html("completed");
    }, 2000);
}

$.when(showLoading()).done(function () {
    heavyCrunch();
});