[英]Importing images from public folder in react
OK last hail mary here.好的,最后在这里向玛丽致敬。 I've seen this question a lot but no clear answer.我见过很多这个问题,但没有明确的答案。 I moved all of my images out of my src
folder to my public
folder into a sub-folder images
.我将所有图像从我的src
文件夹移到我的public
文件夹中的子文件夹images
中。 And used the URL like ./images/my-image.png
but the image isn't populating.并使用 URL 之类的./images/my-image.png
但图像未填充。 I am using create-react-app.我正在使用 create-react-app。 How do I call images from a public
folder outside of my src
folder.如何从我的src
文件夹之外的public
文件夹中调用图像。
change the src from /public/images
to /images
将 src 从/public/images
更改为/images
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.