0

I'm new to REACT and playing around with project at the minute just brushing my skills up.

The problem is I'm having trouble importing icons from this cryptoicons.co site. I had success in another project with when I was using styled ICONS using this package "https://styled-icons.js.org/".

it says in the github

You can then import the icons from ./node_modules/cryptocurrency-icons, for example ./node_modules/cryptocurrency-icons/svg/color/kmd.svg.

I've tried this but I can not get it to work at all. when importing I get the icon back as an object but I need to render it as an SVG

{src: "/_next/static/image/node_modules/cryptocurrency-ic…g/black/AAVE.e6445d0682c7e011efb864fbefdc5239.svg", height: 32, width: 32}

height: 32 src: "/_next/static/image/node_modules/cryptocurrency-icons/svg/black/AAVE.e6445d0682c7e011efb864fbefdc5239.svg" width: 32 proto: Object

they is a gap in my knowledge if someone could poke me in the right direction it would be helpful

I tried this to render the icon with no success

<svg src={icon.src}></svg>

NoobAndroid
  • 86
  • 4
  • 10
  • 2
    Follow the second part of this answer (or the accepted answer on the thread if using webpack 4): https://stackoverflow.com/a/67641345/11613622 -- then you just need to do: ```import Aave from 'cryptocurrency-icons/svg/black/aave.svg';``` To render it simply do `````` – brc-dd Jul 23 '21 at 20:40
  • Here is a sandbox demonstrating the same: https://codesandbox.io/s/agitated-river-s37pv?file=/pages/index.js – brc-dd Jul 23 '21 at 20:59
  • Thanks for your answer. you're example in codesandbox threw an error. The method I used to solve was `import Image from "next/image"` `` – NoobAndroid Jul 24 '21 at 09:55

0 Answers0