Getting undefined when importing svg as ReactComponent in create-react-app project

前端 未结 5 985
礼貌的吻别
礼貌的吻别 2021-02-18 18:56

I\'m getting following error when trying to load svg as ReactComponent.

Element type is invalid: expected a string (for built-in components) or a class/fu

5条回答
  •  旧时难觅i
    2021-02-18 19:50

    if what you need is to import SVGs as a component in React I would recommend this tool https://react-svgr.com/playground/ else the simplest way to deal with SVGs in react is the one mentioned by the other answers above.

提交回复
热议问题