I am trying to render an SVG string as an image in an React component using some straight forward way.
const svg = '<svg version="1" ><line x1="10.6566" y1="24.5918" x2="24.6412" y2="29.6972" stroke="#FF0000" stroke-width="1" /></svg>'
export default function Home(props: Props) {
const { svg } = props;
return (
<div>
<img src={`data:image/svg+xml;utf8,${svg}`} alt="" />
</div>
);
}
I expected this to work, but although the src value looks as expected, nothing is rendered.