0
> My code is returning the string value in the console, but does not return the image even though the path is right in the scr. I do not know what my mistake.I ask for help I am new in language. below is my code:
import React from 'react';
import '../../App.css';
import Servico from './servico';
import Card from 'react-bootstrap/Card';
import CardDeck from 'react-bootstrap/CardDeck';
function ServicesList() {
return (
<div>
{Servico.Servico.map((servicoDetail,)=>{
return <div key={servicoDetail.Posicao}>
<CardDeck>
<Card>
<Card.Img variant="top" src={servicoDetail.Imagem} alt={servicoDetail.Imagem} />
<Card.Body>
<Card.Title>{servicoDetail.Titulo}</Card.Title>
<Card.Subtitle className="mb-2 text-muted">{servicoDetail.Subtitulo}</Card.Subtitle>
<Card.Text>
This is a wider card with supporting text below as a natural lead-in to
additional content. This content is a little bit longer.
</Card.Text>
</Card.Body>
</Card>
</CardDeck>
</div>
})}
</div>
);
}
export default ServicesList;
How the image URL is coming?
– Gabriel Santos
as much as .. /image.png as image.png n can set to work.
– Raphael Filipe
If you put the string value statically inside the
src
, it appears? It seems to me a server problem, you have a static route to access the images?– Andre
putting the static path works, these images are on my computer.
– Raphael Filipe
Are the images inside your project’s src/ or in another directory of your computer? I ask this because they must be served by a web server to function properly
– Gabriel Santos
Company staff gave me a local json.
– Raphael Filipe