JSFiddle - React, Tailwind, and code Playground

HTML

<button>Click Me</button>

JavaScript

$("button").click(DoSomething);

function DoSomething() {
  console.log('start handler');
  $("button").css("pointer-events", "none");
    
  // Hot sleep for 2 seconds
  start = new Date().getTime();
  while (new Date().getTime() < start + 2000) {}

  $("button").css("pointer-events", "auto");   
  console.log('end handler');
}