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

53
Vistas
Node - Show only 1 item while using HTML code in map function

I wanna send a email with node like this:

from: "abc@gmail.com",  
to: "test@gmail.com",  
subject: "test",  
html: <p>Message</p>

This works fine but when i wanna map some data in the html input it shows only the last item (quantity)

<div style="color: #f59e0b;">${cartItems.map((item) => {
 return item.name, item.quantity;
 })}
</div>

If I use html inside the template-literals I get an error: SyntaxError: Unexpected token '<'

${cartItems.map((item) => {
return(
 <div>
     <div style='color: #fff;'> item.name</div>
     <div style='color: #fff;'> item.name</div>
 </div>
)
})}
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

By using ${} you kind of disable the string temporarily, so HTML syntax doesn't make sense

${cartItems.map((item) => {
return(`
 <div>
     <div style='color: #fff;'> ${item.name}</div>
     <div style='color: #fff;'> ${item.name}</div>
 </div>
`)
})}
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