ReactJS and images in public folder

后端 未结 7 1608
北恋
北恋 2020-11-30 01:15

Im new in ReactJS and I want to import images in a component. These images are inside of the public folder and I do not know how to access the folder from the react componen

7条回答
  •  猫巷女王i
    2020-11-30 01:33

    To reference images in public there are two ways I know how to do it straight forward. One is like above from Homam Bahrani.

    using

         
    

    And since this works you really don't need anything else but, this also works...

        
    

提交回复
热议问题