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

169
Vistas
React - BackgroundImage with data doesn't display

I'm using React and i'm trying to inject dynamically a backgroundImage from a data.json, so i'm writing my backgroundImage directly in the jsx, as inline-style, but the background don't wants to show up. I've already checked the source, and it's correct !

I'll give you a code sample and a screen of my console to show you that my path for the backgroundImage is correct !

const Card = ({ artCard }) => {
const backgroundThumbnail = artCard.images.thumbnail;
console.log(backgroundThumbnail);
return (
<React.Fragment>
  <div
    className="card"
    style={{
      backgroundImage: `url(${backgroundThumbnail})`,
      backgroundRepeat: "no-repeat",
      backgroundSize: "cover",
      backgroundPosition: "center",
      minHeight: "300px",
      minWidth: "300px",
    }}
  >
    {/* <h3>{artCard.name}</h3> */}
    {/* <h4>{artCard.artist.name}</h4> */}
  </div>
</React.Fragment>
);
};

Screenshot 👇 google console

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You forgot to add a double quote inside the bracket, try this:

backgroundImage: `url("${backgroundThumbnail}")`

Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/background-image

about 4 years ago · Santiago Trujillo Denunciar

0

Alright, found the problem, my images were not on the public folder, so react won't read it !

about 4 years ago · Santiago Trujillo 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