React onClick – pass event with parameter

Without Parameter

function clickMe(e){
  //e is the event
}

<button onClick={this.clickMe}></button>

With Parameter

function clickMe(parameter){
  //how to get the "e" ?
}
<button onClick={() => this.clickMe(someparameter)}></button>

I want to get the event. How can I get it?

105 thoughts on “React onClick – pass event with parameter”

  1. First off I want to say awesome blog! I had a quick question that I’d like to ask if you don’t
    mind. I was interested to know how you center yourself and clear your thoughts before writing.
    I’ve had trouble clearing my mind in getting my ideas out.
    I do take pleasure in writing however it just seems like the
    first 10 to 15 minutes are lost simply just trying to figure out how to begin.
    Any recommendations or hints? Kudos! http://antiibioticsland.com/Erythromycin.htm

    Reply

Leave a Comment