[英]Attempted import error: 'FaPencil' is not exported from 'react-icons/fa'
I am new to ReactJS, now i want to include ( React-icons ) in my project but it give me error.我是 ReactJS 的新手,现在我想在我的项目中包含( React-icons ),但它给了我错误。 could you please help me .
请你帮助我好吗 。
Error : Attempted import error: 'FaPencil' is not exported from 'react-icons/fa'
错误:尝试导入错误:“FaPencil”未从“react-icons/fa”导出
Code is below代码如下
import React, { Component } from "react";
import { FaPencil } from "react-icons/fa";
import { FaTrash } from "react-icons/lib/fa/trash";
export default class Note extends Component {
render() {
return (
<div className="note">
<p>Learn React</p>
<span>
<button onClick={this.edit} id="edit">
<FaPencil />
</button>
<button onClick={this.remove} id="remove">
<FaTrash />
</button>
</span>
</div>
);
}
}
import FaPencil from 'react-icons/lib/fa/pencil'
You don't need to destructure since you're pointing directly to the file.您不需要解构,因为您直接指向文件。 Using
react-icons
it's helpful to go to the node_modules
folder to see where icons live.使用
react-icons
转到node_modules
文件夹查看图标所在的位置会很有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.