Answer the question
In order to leave comments, you need to log in
Images not showing on localhost (React) How to fix?
Good afternoon, the problem is that the images do not open, even if it is in the same folder as the component itself ... In fact, the images are in a completely different folder, but due to the fact that they do not want to open, I started Throw them into the same folder, but it still does not open. I tried a bunch of paths, other formats ...
for example, I set:
technologies: [
{
name: 'development',
path: 'dev.png',
link: '/'
}
...
{
this.state.technologies.map(function (res, i) {
return <a key={i} href={res.link} >
<img src={res.path} />
<span class="name">{res.name}</span>
</a>
})
}
Answer the question
In order to leave comments, you need to log in
In the file where the img tag is located, import your image, and then refer to this import in src.
Jusss , but what does it write in the path for src, if you look at the usual DOM?
Webpack will read from the public folder that you specified, when adding files, always write ./
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question