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

106
Views
Representar un className específico cuando está activo con classNames y Tailwind

Estoy usando Tailwinds CSS y el paquete classNames .

Estoy representando 2 div s y quiero verificar si uno de ellos tiene una clase active , luego establecer un color de fondo específico className bg-[#000] para él.

  • Intenté usar 'bg-[#000]': 'active' pero esto solo inserta el color de fondo en todos los elementos.

¿Cómo podemos establecer un estilo específico para un elemento activo con Tailwind y classNames ?

¡Gracias!

Código:

 list.map((page, index) => { return ( <div key = {index} onClick = {() => setCurrentListIdx(index)} className = { classNames('bullets__item m-1.5 h-2 w-2 cursor-pointer rounded-full bg-[#e0e0e0]', { active: currentListIdx === +index, 'bg-[#000]': 'active', } )} ></div> ) })
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!