JSFiddle - React, Tailwind, and code Playground
by bizamajig
HTML
<svg>
<g>
<rect class="imagerect" x="0" y="0" width="100" height="100" style="fill: lightsteelblue"></rect>
<image xlink:href="https://www.google.com/images/srpr/logo11w.png" x="25" y="25" height="50px" width="50px" />
</g>
</svg>
JavaScript
d3.select("image")
.on("click", changeColor);
function changeColor() {
d3.select(".imagerect")
.style("fill", "lightsalmon");
};