パラメータなし
function clickMe(e){
//e is the event
}
<button onClick={this.clickMe}></button>
パラメータ付き
function clickMe(parameter){
//how to get the "e" ?
}
<button onClick={() => this.clickMe(someparameter)}></button>
を入手したいのですがevent
、どうすれば入手できますか?
ベストアンサー1
これを試して:
<button
onClick={(e) => {
this.clickMe(e, someParameter);
}}
>
Click Me!
</button>
そしてあなたの関数では:
function clickMe(event, someParameter){
//do with event
}