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

144
Views
change className to using template literals

i'm trying to learn template literals, i have project of mine i need to use template literals there, i have a question which seems very simple, but dont know what i am doing wrong

this is working:

const classes = props.classes;

return (
<List
  component="div"
  data-testid="SelectionListt"

  className={classes.selectionList__sites}
>

</List>
);

my question is how should i turn that className using template literals.

This is what i have done:

 const classes = props.classes;

  return (
    <List
      component="div"
      data-testid="SelectionListt"
       className={` ${classes + ".selectionList__sites"} `}`
     
    >
    
    </List>
  );

this is my selectionList__sites:

 selectionList__sites: {
      backgroundColor: "white",
      "&:hover": {
        backgroundColor: " red",
        color: "black",
        border: "1px solid yellow",
      },
    },

English is not my mother language so there could be mistakes.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Template literals have no need for regular quotes inside them, basically the entire content between backticks is handled as a string, except for values inside ${}.

Assuming that props.classes is a string, I would write your className like this:

className={`${classes}.selectionList__sites`}
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!