I am facing an issue with filling an SVG path with a background image. I have tried various methods found on Google, but none seem to work as expected. Here is the code snippet I have been working with:
<div className="intro">
<p>Any text</p>
<svg fill="url(#pattern)">
<defs>
<pattern id="pattern">
<image href={introImage}/>
</pattern>
</defs>
<path d={path()}/>
</svg>
</div>
Despite following this setup, the SVG still doesn't display the background image. Interestingly, setting fill="red"
works perfectly fine.
After thorough inspection, I believe the issue might be related to React and its handling of SVG elements. The image link and the "d" attribute of the path are indeed correct, so my question is how can I resolve this dilemma?