How to call more than one function in javascript onclick event?

<Button onClick={(e)=>setId(_id); handleDelete()}>Delete

I tried this way, but it gives error.

>Solution :

I think you must wrap the content of the arrow function in { }, like this

<Button onClick={(e) => {setId(_id); handleDelete()} }>Delete</Button>

and don’t forget the closing tag for the Button component

I hope that solves your problem.

Leave a Reply