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

257
Vistas
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 Respuestas
Responde la pregunta

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