JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<head>
</head>
<body>
<h1>Unload Test</h1>
</body>
</html>
JavaScript
$(window).bind("beforeunload", function() {
return confirm("Are you sure you want to leave?");
});