JSFiddle - React, Tailwind, and code Playground

JavaScript

$(window).on("beforeunload", function() { console.log("there are some files uploading"); return "there are some files uploading" });
    
$(window).on("beforeunload", function() { console.log("there is no change on the textbox, so no problem at all"); return null });