JSFiddle - React, Tailwind, and code Playground

HTML

<img id="imgId" src="https://www.google.com/logos/doodles/2021/mid-autumn-festival-2021-taiwan-6753651837109079-l.webp">
<button id="refresh">
refresh
</button>

JavaScript

$("#refresh").click(function() {
  oldSrc = $("#imgId").attr('src');
  imagePath = oldSrc.split('?')[0];
  newSrc = imagePath + "?time=" + new Date().getTime();
  $("#imgId").attr('src', newSrc);
});