JSFiddle - React, Tailwind, and code Playground
HTML
<div class="gallery">
<img src="//lorempixel.com/200/200" />
</div>
JavaScript
$(".gallery img").each(function () {
$(this).attr("src", function (a, b) {
return b.replace("200/200", "400/400");
});
});