I am using react + webpack + d3.
I am building a dynamic SVG graph using D3.
I can add image an SVG
as follows in react:
import file_1 from '../../icons/03_file_reg.svg';
<image src={file_1}... />
This works. But I am trying to figure out how to do it with D3
:
<svg id="test_svg">
</svg>
d3.select("#test_svg").append("image").attr("xlink:href", {file_1}).attr("width", 10)....
This doesn't work.
I have seen another way to do it like so: how to use svg file for image source in D3
but his forces me to use static path to my svg instead of importing. is this the only way to do it? or can i use import some other way?