React onClick - pass event with parameter

后端 未结 5 705
半阙折子戏
半阙折子戏 2020-12-22 17:33

Without Parameter

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


With Para

5条回答
  •  Happy的楠姐
    2020-12-22 18:08

    With the ES6, you can do in a shorter way like this:

    const clickMe = (parameter) => (event) => {
        // Do something
    }
    

    And use it:

提交回复
热议问题