Get the svg element as a string from a file source
(src)
| 10 | |
| 11 | /** Get the svg element as a string from a file source */ |
| 12 | async function getSVGHTML(src) { |
| 13 | let file = await fetch(src); |
| 14 | let content = await file.text(); |
| 15 | let SVGElement = svgFromString(content); |
| 16 | return SVGElement.outerHTML; |
| 17 | } |
| 18 | |
| 19 | /** Creates an inline SVG from a source */ |
| 20 | const SVG = ({src, ...props}) => { |