只需在React js中一键调用函数
handleProjectSelection = (v1, v2) => () => {
console.log(`${v1} and ${v2}`)
}
anotherfunctionCall = (ss) => () => {
console.log(ss)
}
<p onClick={() => { this.handleProjectSelection("sdsdsd", 'dksdsd'); this.anotherfunctionCall("second");}}> click event </p>
如果有两个带有双箭头的功能,那么我想在一次单击中同时调用它们
答案 0 :(得分:1)
您仅需使用one
箭头功能即可调用onClick
事件。
handleProjectSelection = (v1, v2) => {
console.log(`${v1} and ${v2}`)
}
anotherfunctionCall = (ss) => {
console.log(ss)
}
<p onClick={() => { this.handleProjectSelection("sdsdsd", 'dksdsd'); this.anotherfunctionCall("second");}}> click event </p>
答案 1 :(得分:0)
handleOnClick = (v1,v2,ss) {
handleProjectSelection(v1,v2);
anotherfunctionCall(ss);
}
<p onClick={() =>{ this.handleOnClick("sdsdsd", 'dksdsd',"second")> click event </p>