How to fix svg iconmoon not working on codesandbox

Viewed 260

I'm currently trying to use icons from iconmoon with 'use' tag in a react small project on codesandbox. Unfortunately, you won't see any icons on the screen. Below, the link where the problem occurs, line 45.

https://codesandbox.io/s/new-otrs7

I've already tried to put the svg on public folder and refer to it using link tag inside head. Still does not work.

<use xlinkHref="./img/sprite.svg#icon-react" />

I'd like to have the react icon to appear.

Thank you in advance!

1 Answers

I got this to work for a Vue project on codesandbox.io by putting the SVG in the public directory and then in my template I did this:

<img src="icon-name.svg" />
Related