JSFiddle - React, Tailwind, and code Playground
HTML
<svg>
<rect x="20" y="20" width="100" height="100" stroke-width="20"/>
</svg>
JavaScript
function rectToString(rect) {
return rect.left + "," + rect.top + "," + rect.width + "," + rect.height;
};
var p = document.createElement("p");
p.textContent = "bbox: " + rectToString(document.getElementsByTagName("rect")[0].getBoundingClientRect());
document.body.appendChild(p);