Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

354
Views
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 answers
Answer question

0

Use backticks like so:

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

about 4 years ago · Juan Pablo Isaza Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!