JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head></head>
<body><svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100"></svg></body>
</html>
JavaScript
let d = document.createElement("polygon");
d.setAttribute("points", "0,0 100,0 50,100");
d.setAttribute("fill", "orange");
d.setAttribute("stroke", "black");
d.onclick = function(event) {
alert(1);
};
document.querySelector("svg").append(d);