I created an SVG rectangle by code, that I'm trying to render in React. I tried different things including dangerouslySetInnerHTML, without success.
In below example, 'return t' works, 'return svgRectElement' doesn't.
How can I return the svg generated by svgRectElement? Thanks!
public render() {
let svgRectElement: SVGRectElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
svgRectElement.setAttributeNS(null, 'width', "300");
svgRectElement.setAttributeNS(null, 'height', "300");
svgRectElement.setAttributeNS(null, 'id', "myrect");
var t: JSX.Element = <rect width="300" height="100" id="myrect"></rect>;
return t;
}