最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - IO icons from "react icons" not importing - Stack Overflow

programmeradmin0浏览0评论

I've installed the react-icons module correctly with npm, and everything is working great. I can import icons without any errors, but sadly whenever I try and import an icon with Io before it like

  • IoSettingsSharp
  • IoSettingsOutline etc.

    simply like:

    import { IoSettingsOutline } from 'react-icons/io'
    class Home extends Component{
        render(){
            return (
                <div className="app">
                    <Link to='/settings'>
                    <IoSettingsOutline className="settings-icon"/>
                    </Link>
                </div>
           )
        }
    };
    

    I get the error:

    ./src/Home.js Attempted import error: 'IoSettingsOutline' is not exported from 'react-icons/io'.

    And what's funny about this is, I've imported every other icon just like this, switching out the name and the ending of 'react-icons/io'

    What is happening and how can I fix this?

    I've installed the react-icons module correctly with npm, and everything is working great. I can import icons without any errors, but sadly whenever I try and import an icon with Io before it like

  • IoSettingsSharp
  • IoSettingsOutline etc.

    simply like:

    import { IoSettingsOutline } from 'react-icons/io'
    class Home extends Component{
        render(){
            return (
                <div className="app">
                    <Link to='/settings'>
                    <IoSettingsOutline className="settings-icon"/>
                    </Link>
                </div>
           )
        }
    };
    

    I get the error:

    ./src/Home.js Attempted import error: 'IoSettingsOutline' is not exported from 'react-icons/io'.

    And what's funny about this is, I've imported every other icon just like this, switching out the name and the ending of 'react-icons/io'

    What is happening and how can I fix this?

    Share Improve this question edited Jul 13, 2021 at 21:04 Buddy Bob asked Jul 13, 2021 at 20:18 Buddy BobBuddy Bob 5,8891 gold badge18 silver badges49 bronze badges 2
    • 2 There are different Ionicons versions. You'll either want to import from io (which is Ionicons v4) or io5. Click on the links provided to see which icons are supported for each version. In your case, IoSettingsOutline es from io5. – Matt Carlotta Commented Jul 13, 2021 at 21:24
    • Ok that makes sense! – Buddy Bob Commented Jul 13, 2021 at 21:35
    Add a ment  | 

    2 Answers 2

    Reset to default 8

    as @Matt Carlotta said: "There are different Ionicons Ionicons v4 io5"

    try:

    import { IoSettingsOutline } from 'react-icons/io5'
    

    The below import worked for me,

    import { IoSettingsOutline } from 'react-icons/io5'
    
  • 发布评论

    评论列表(0)

    1. 暂无评论