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

355
Vistas
Why dollar sign and brackets inside string do not work? Javascript/npm/react

I am taking HTML/CSS/JS course. There is exercise to create web app with robofriends. There should be many robofriends photos, but I got return only the same. Could you please check if I am doing something wrong? Brackets inside string do not work: <img alt='robots' src={"https://robohash.org/${id}?200x200"} />

As is MyFriends

As should be RoboFriends

Code

    import React from 'react';



const Card = (props) => {
    const { email, name, id } = props;

    return (
        

        <div className="tc bg-light-green dib br3 pa3 ma2 grow bw2 shadow-5">
            <img alt='robots' src={"https://robohash.org/${id}?200x200"} />
            <div>
            <h2> {name} </h2>  
            <p>{email}</p>  
            </div>
        </div>
    );
}

export default Card;


    enter code here
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Use backticks like so:

  <img alt='robots' src={`https://robohash.org/${id}?200x200`} />

about 4 years ago · Juan Pablo Isaza Denunciar

0

Template literals are used with backticks, in your example you should replace the src in the img tag with the following: src={`https://robohash.org/${id}?200x200`}.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Double quotes don't support ${}.

Use:

<img alt='robots' src={`https://robohash.org/${id}?200x200`} />

Or

<img alt='robots' src={"https://robohash.org/" + id + "?200x200"} />

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