Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda