Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda