Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
Getting broken image icon when displaying image from online url in ReactJS

The webpage display is fine otherwise. but the images show up like this.

my code is <img src = {props.imageUrl} /> and console.log(prop) returns

{...imageUrl: "https://unsplash.com/photos/3PeSjpLVtLg"...}

What could be the problem? Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The url is a web page. It is not a url to an image so an image tag won't be able to display it. In the case of this specific image, you want the url to be this:

https://images.unsplash.com/photo-1601439678777-b2b3c56fa627?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80
about 4 years ago · Juan Pablo Isaza Relatório

0

Try adding the require to the src image like this:

<img src = { require(props.imageUrl)} />

Another way around would be in the props adding the require :

Example:

 const slides = {
 imageUrl: require('url'),
}

and leave your code as it is in the <img src = {props.imageUrl} />

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda