how to combine below two functions , which I need to use in single element. Please help
onClick={() => setSelectedItem("List A")}
onClick={(e) => e.stopPropagation()}
e.g <a onClick={function1, funtion2}
CodePudding user response:
onClick={(e) => {setSelectedItem("List A"); e.stopPropagation()}}
CodePudding user response:
invoke them all in one function body
<a onClick={(e) => {
e.stopPropagation();
setSelectedItem("List A")
}} >
CodePudding user response:
Just put them into a single function
onClick = {(e) => {
e.stopPropagation();
setSelectedItem("List A");
}}