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

255
Views
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 answers
Answer question

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