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

159
Visualizações
React router Link tag color is not changing in build environment

I am using tailwind with react and using conditional rendering to change the color of the link tags in the navbar based on different screens. It works fine in the localhost but when I run the build and place it on the server the link's color remains the same. Here is the code for the link

 <NavLink
            to={`${Routes.main}`}
            className={`m-2 block mt-4 lg:inline-block lg:mt-0  lg:${
              heroSection ? "text-white" : "text-teal-200"
            }`}
          >

What is the reason for it to work on the local environment and not in the build?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Don't use string concatenation to create class names:

lg:${heroSection ? "text-white" : "text-teal-200"}

Do dynamically select a complete class name:

${heroSection ? "lg:text-white" : "lg:text-teal-200"}

That means that it is important to avoid dynamically creating class strings in your templates with string concatenation, otherwise PurgeCSS won’t know to preserve those classes.

learn more: Tailwind Optimizing for Production

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