Answer the question
In order to leave comments, you need to log in
How to display images in react?
Good afternoon.
The question is hackneyed, we repeatedly discuss it, with a bunch of decisions, and so on .. But!
Problem. Images are not displayed in the project.
React, jsx component.
component path:
/src/components/post/post.jsx
Tried to upload image to: -public folder -public
/images
folder
-src folder -src
/images
-in /src/components/images Image is displayed in two cases:
1 ) if it is in the folder with the component. Near.
2) or if it's stupid to import, and insert
import mops from './images/mops.jpeg';
src={mops}
I don't understand what the problem is, as it didn't happen in other projects.
Tried a bunch of things, came up with nothing.
I think you can stick it through webpack by writing the paths there. But I don’t really want to mess with him because of one picture.
Thanks in advance
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question