JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://www.google.com" target="_new" onclick="return doWork();">Click to redirect</a>

JavaScript

function doWork(){
          alert("redirecting");
          //... do your works
          return true; // then return true to redirect
    }