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

253
Visualizações
REACT Multi steps form : Next button doesn't work and first circle already in green

I'm beginner in REACT and I'm trying to create a multi steps form in React. How do I hide the BACK button for the first page (see the picture please).

enter image description here

export default function StepperControl({ handleClick, currentStep, steps }) {
    return (
        <div className="container mt-4 mb-8 flex justify-around">
            <button
                onClick={() => handleClick()}
                className={`cursor-pointer rounded-xl border-2 border-slate-300 bg-white py-2 px-4 font-semibold uppercase text-slate-400 transition duration-200 ease-in-out 
                hover:bg-slate-700 hover:text-white  ${currentStep === 1 ? " cursor-not-allowed opacity-50 " : ""
                    }`}
            >

                Back
            </button>

            <button
                onClick={() => handleClick("next")}
                className="cursor-pointer rounded-lg bg-blue-700 py-2 px-4 font-semibold uppercase text-white transition duration-200 ease-in-out hover:bg-slate-700 hover:text-white"
            >
                {currentStep === steps.length - 1 ? "Confirm" : "Next"}
            </button>
        </div>
    );
}

Many thanks for your help

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

I guess this is what you need.

export default function StepperControl({ handleClick, currentStep, steps }) {
    return (
        <div className="container mt-4 mb-8 flex justify-around">
            {
                currentStep > 1 &&
                    <button
                        onClick={() => handleClick()}
                        className={`cursor-pointer rounded-xl border-2 border-slate-300 bg-white py-2 px-4 font-semibold uppercase text-slate-400 transition duration-200 ease-in-out 
                        hover:bg-slate-700 hover:text-white cursor-not-allowed opacity-50`}
                    >

                        Back
                    </button>
            }

            <button
                onClick={() => handleClick("next")}
                className="cursor-pointer rounded-lg bg-blue-700 py-2 px-4 font-semibold uppercase text-white transition duration-200 ease-in-out hover:bg-slate-700 hover:text-white"
            >
                {currentStep === steps.length - 1 ? "Confirm" : "Next"}
            </button>
        </div>
    );
}

Also, you should send currentStep as a number/integer, not as an object.

about 4 years ago · Santiago Gelvez 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