如何组合两个箭头函数?
How to combine two arrow function?
如何组合以下两个函数,我需要在单个元素中使用它们。请帮忙
onClick={() => setSelectedItem("List A")}
onClick={(e) => e.stopPropagation()}
e.g <a onClick={function1, funtion2}
在一个函数体中调用它们
<a onClick={(e) => {
e.stopPropagation();
setSelectedItem("List A")
}} >
只需将它们放入一个函数中即可
onClick = {(e) => {
e.stopPropagation();
setSelectedItem("List A");
}}
onClick = {(e) => { setSelectedItem("List A"); e.stopPropagation() }}
如何组合以下两个函数,我需要在单个元素中使用它们。请帮忙
onClick={() => setSelectedItem("List A")}
onClick={(e) => e.stopPropagation()}
e.g <a onClick={function1, funtion2}
在一个函数体中调用它们
<a onClick={(e) => {
e.stopPropagation();
setSelectedItem("List A")
}} >
只需将它们放入一个函数中即可
onClick = {(e) => {
e.stopPropagation();
setSelectedItem("List A");
}}
onClick = {(e) => { setSelectedItem("List A"); e.stopPropagation() }}