Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
Add class on "next" and remove on "prev" on progress bar - React

So I want to add a class to each of these list items in order, and not simultaneously, whenever you press "Next", and ofc remove them again after pressing "previous". I'm working in React and i know you can do something with State etc, but I'm new at React, so any help is appreciated.

HTML

<ol id="prog" className="progress-track">
                    <li className="progress-1">
                        <div className="icon-wrap"></div>
                        <span className="progress-text">The position</span>
                    </li>

                    <li className="progress-2 test">
                        <div className="icon-wrap"></div>
                        <span className="progress-text">Qualifications</span>
                    </li>

                    <li className="progress-3 test">
                        <div className="icon-wrap"></div>
                        <span className="progress-text2">
                            Abtion as a workplace
                        </span>
                    </li>

                    <li className="progress-4 test">
                        <div className="icon-wrap2"></div>
                        <span className="progress-text3">Apply</span>
                    </li>
                </ol>

Let me know if you need any more information! The design

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You will need to have a state. Like const [activeItem, setActiveItem] = useState(1);

As you have 4 items you will have four possible state types.

and when you click on each item you will set your state to that items id. For example when you click on Item 3 you will set your state to 3. and check if your state is equal to 3 you will set a class to your className. className={example ${activeItem === 1 ? 'active' : ''}}. And when clicking to Next you will just add 1 to the current state and minus one from state you have when you click on the previous. And check if your state num is on 4 it means your reached limit. and when user clicks 5 time to set your state to 1.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda