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

271
Views
onClick function running automatically - Function with parameters

I have a react code where I added this function below that is running automatically. I don't need to click, it just runs.

How can I fix this?

    function handleUpadeVacationStatus(id){
        alert(id)
    }

return (
    <div>
        {vacations.map( (vac) => {
            return(
                <div className="vacationDIV">
                    
                    <div>
                        <p>{vac?.convering} is covering {vac?.underCover}</p>
                        <p>from {moment(vac?.startdate).format("L") } to { moment(vac?.enddate).format("L") }</p>
                    </div>
                    <div className="cancelVAc" onClick={handleUpadeVacationStatus(vac?._id)}>
                        <img src={trashimg} alt="Click here to delete vacation coverage"/>
                    </div>
                    

                </div>
            )
        })}
    </div>
)

about 4 years ago · Juan Pablo Isaza
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!