reactjs - 在 REACT 中从 cyrptoicons 导入 SVG 时遇到问题
问题描述
我是 REACT 的新手,现在正在玩项目,只是为了提高我的技能。
问题是我无法从这个cryptoicons.co网站导入图标。当我使用此包“https://styled-icons.js.org/”使用样式化图标时,我在另一个项目中取得了成功。
它在github上说
You can then import the icons from ./node_modules/cryptocurrency-icons, for example ./node_modules/cryptocurrency-icons/svg/color/kmd.svg.
我已经尝试过了,但我根本无法让它工作。导入时,我将图标作为对象返回,但我需要将其渲染为 SVG
{src: "/_next/static/image/node_modules/cryptocurrency-ic…g/black/AAVE.e6445d0682c7e011efb864fbefdc5239.svg", height: 32, width: 32}
高度:32 src:“/_next/static/image/node_modules/cryptocurrency-icons/svg/black/AAVE.e6445d0682c7e011efb864fbefdc5239.svg”宽度:32 原型:对象
如果有人可以朝正确的方向戳我,那将是我知识上的空白,这将很有帮助
我试过这个来渲染图标没有成功
<svg src={icon.src}></svg>
解决方案
推荐阅读
- c# - 将数据绑定到用户控件 (UWP) 内的 ListView
- html - 里面有图标的css圆圈
- java - Java 简单易用的 lambda 函数,例如 Python
- postgresql - 带有 PostgreSQL 数据库的环回用户模型
- reactjs - 棱镜:如何从 API 中提取自定义类型的所有“选择”字段?
- webpack-encore - symfony/encore:隐藏依赖警告
- spring-boot - Sharding-jdbc:precisionAlgorithmClassName:java -jar project.jar error:Caused by: java.lang.ClassNotFoundException
- typescript - 我应该如何从一个包中导出多组类/接口
- wordpress - 获取自定义帖子类型名称返回空
- json - 为什么 Mongo JSON 查询无法由 runMangoAggregation Processor Nifi 执行?