Load local images in React.js

后端 未结 10 2099
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 23:08

I have installed React using create-react-app. It installed fine, but I am trying to load an image in one of my components (Header.js, file path: <

10条回答
  •  一个人的身影
    2020-11-30 23:34

    In order to load local images to your React.js application, you need to add require parameter in media sections like or Image tags, as below:

    image={require('./../uploads/temp.jpg')}
    

提交回复
热议问题