简体   繁体   English

尝试导入错误:“FaPencil”未从“react-icons/fa”导出

[英]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.

相关问题 尝试导入错误:“FaBars”未从“react-icons/fa”导出 - Attempted import error: 'FaBars' is not exported from 'react-icons/fa' react-icons/fa 安装失败:尝试导入错误:“FaStar”未从“react-icons/fa”导出 - react-icons/fa fails to install: Attempted import error: 'FaStar' is not exported from 'react-icons/fa' 尝试导入错误:“AiFillMessage”未从“react-icons/fa”导出(导入为“MessengerIcon”) - Attempted import error: 'AiFillMessage' is not exported from 'react-icons/fa' (imported as 'MessengerIcon') 图标未从 react-icons 导出,并显示编译器错误 - Icon is not exported from react-icons and compiler error is shown 使用反应图标时导入错误 - import error when using react-icons react-icons 的动态导入 - Dynamic import of react-icons 如何从 react-icons 导入 Material Design 中的所有图标 - how to import all icons in Material Design from react-icons 尝试导入错误:'未从 - Attempted import error:' is not exported from 反应错误“尝试导入错误:'TodoItem'未从'./Todoitem'导出。” - error in react " Attempted import error: 'TodoItem' is not exported from './Todoitem'. " 尝试导入错误:“getMoviesList”未从“./actions”导出; 反应错误 redux - Attempted import error: 'getMoviesList' is not exported from './actions'; error in react redux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM