I have some svg
files in my project assets.
Using them as the src
of img
works fine, but I cannot set their fill color.
<img src={require('./assets/foo.svg')} alt={props.svg} />
Using some examples, I tried to use svg
-use
combo, but it resulted with a 0x0
use
element.
<svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" width="80" height="80" viewBox="0 0 32 32">
<use xlinkHref={require('./assets/foo.svg')} width="80" height="80"/>
</svg>
What is the correct way to define an svg
element from a real svg
asset? Without of course copying the content of the file.