cannot import image with create-react-app

前端 未结 5 1550
悲&欢浪女
悲&欢浪女 2021-02-18 21:43

I\'m using create-react-app, and I am struggling to load images. I am following the instructions as specified here, but I keep seeing the following error:



        
5条回答
  •  没有蜡笔的小新
    2021-02-18 22:26

    You can simply use something like this:

    render() {
      // Note: this is an escape hatch and should be used sparingly!
      // Normally we recommend using `import` for getting asset URLs
      // as described in “Adding Images and Fonts” above this section.
      return ;
    }
    

    Quoted directly from CRA docs

提交回复
热议问题