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

126
Vistas
Passing color as prop

I'm creating a "profile card" component using an array and the map() function to render data dynamically instead of hardcoding it. I'd like each person's profile to have a different border color, so I'm attempting to pass the color as a prop to the styling of the component. In the array, there is a color key with one HEX value per person. I'm passing it down as a prop from the array. What I'd like to do is make something like style={{border: '1px solid props.color' but I'm not sure how to do so. Please let me know if you have any ideas!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Use template literals. Something like this: style={{border: `1px solid ${props.color}`}}

about 4 years ago · Juan Pablo Isaza Denunciar

0

You could just add a template literal to add the prop to the string, e.g.

style={{border: `1px solid ${props.color}`}}
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