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

153
Views
How do I combine a string + javascript for a className?

How do I combine a javascript variable with a string? Do I have to concat the variable?

{ /* JSX + Bootstrap */ }
<div className={s.container} + "col-md-offset-4 col-md-4 well">

Edit: Thank you for the help. Here's the error I'm getting

<div className={'col-md-offset-4 col-md-4 well' + s.container}>
// Error: Unexpected string concatenation

Thank you for the suggestions... Here's the error I get when I follow these docs http://eslint.org/docs/2.0.0/rules/prefer-template

Module build failed: SyntaxError: JSX value should be either an expression or a quoted JSX text (23:23)

  21 |     return (
  22 |       <div className={s.root}>
> 23 |         <div className=`col-md-offset-4 col-md-4 well ${s.container}`>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

@Poke and @Andrew Li deserves credit for figuring this one out. You need to follow the docs but also put it inside javascript with the curly brackets

<div className={`col-md-offset-4 col-md-4 well ${s.container}`}>
over 4 years ago · Santiago Trujillo 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!