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

190
Views
Is having onClick set to null on a <button/> a bad practice in React.js?

I'm creating a custom Button component in react.js. I was wondering if having onClick={null} on a HTML button would create unnecessary event listeners that I don't need?

<button value="test" onClick={onClickHandler} onSubmit={onSubmitHandler}/>

I would use this technique if that is the case:

<button value="test" {...(onClickHandler && {onClick:onClickHandler})} {...(onSubmitHandler && {onSubmit:onSubmitHandler})}/>              
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If your looking to make the button unclickable after a certain event, just make sure its disables after that event.

<button value="test" onClick={null} disable={valuable onevent here set it to true} />
about 4 years ago · Juan Pablo Isaza 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!