![](/img/trans.png)
[英]Attempted import error: 'FaBars' is not exported from 'react-icons/fa'
[英]Attempted import error: 'FaPencil' is not exported from 'react-icons/fa'
我是 ReactJS 的新手,現在我想在我的項目中包含( React-icons ),但它給了我錯誤。 請你幫助我好嗎 。
錯誤:嘗試導入錯誤:“FaPencil”未從“react-icons/fa”導出
代碼如下
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'
您不需要解構,因為您直接指向文件。 使用react-icons
轉到node_modules
文件夾查看圖標所在的位置會很有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.