JSFiddle - React, Tailwind, and code Playground

HTML

<html>

  <head>
    <script>
      $(document).ready(function() {
        var limit = 5; // the time limit (in milliseconds) for the disable function
        var timer = setTimeout(disableMyButton, limit);

        function disableMyButton() {
          $('#myButton').prop('disabled', true);
          $("#statusMsg").text("Disabling before page refresh");
          localStorage.setItem("isMyButtonDisabled", "true");
        }

        if (localStorage.getItem("isMyButtonDisabled") == "true") {
          $("#statusMsg").text("Disabling after page refresh");
          $('#myButton').prop('disabled', true);
          window.clearTimeout(timer);
        }
      });

    </script>
  </head>
  <input type="button" id="myButton" value="Click me" />
  <p id="statusMsg"> </p>

</html>