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

125
Views
Problems with tailwindcss and reactjs

I'm building a project with reactJS for a school project. In this project I am allowed to use css frameworks, and I chose tailwindcss because I already have used it before.

But now, I am getting an ackward bug when trying to concatenate class with react variables.

I already changed tailwind.config.js to extend width values, like this piece of code below:

module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {
      width : {
        '10r' : '25rem',
        '12r' : '30rem',
        '15r' : '37.5rem'
      }
    },
  },
  plugins: [],
}

And what I am trying to do in react file, is this below:


const Body = () => {
    const [tamanhoTab, setTamanhoTab] = useState(15)

    return (
        <div className="h-[60vh] w-4/5 bg-blue-100 m-auto mt-16">

            <div className={`bg-black h-10 w-${tamanhoTab}r flex space-x-px flex-wrap`} id="tabuleiro">
            </div>
         </div>
   )
}

export default Body

The width of the div simply doesn't change, but if I write this instead:

    <div className={`bg-black h-10 w-15r flex space-x-px flex-wrap`} id="tabuleiro">
    </div>

It works! I'm frustrated because I already researched about this and found nothing useful, and I'm sure that this is a stupid mistake that I can't solve!

Anyone have a clue what this might be?

I hope it's not confusing, Thanks,

about 4 years ago · Juan Pablo Isaza
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!