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

173
Visualizações
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 Respostas
Responde à pergunta

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 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