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

97
Views
How to interpolate within an interpolation?

I have a constant called CLASSES:

const CLASSES = {
    root: "root",
    vertical: "master",
    horizontal: "alternate",
} 

I have a variable gridType which has a value of either a string of vertical or horizontal.

render() {
    const { gridType } = this;  // equals either a string of 'vertica'l or horizontal 


    return html `<div class="${CLASSES.root}"</div>`;
}

How would I add gridType class to the returned html? I can't do <div class="${CLASSES.root} ${CLASSES.gridType}"</div> since gridType is not a value on CLASSES

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

0

You can use bracket-notation:

<div class="${CLASSES.root} ${CLASSES[gridType]}"</div>
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!