Skip to content
Advertisement

Call multiple functions onClick ReactJS

I know in vanilla JavaScript, we can do:

JavaScript

What would be the equivalent for making two function calls onClick in ReactJS?

I know calling one function is like this:

JavaScript

Advertisement

Answer

Wrap your two+ function calls in another function/method. Here are a couple variants of that idea:

1) Separate method

JavaScript

or with ES6 classes:

JavaScript

2) Inline

JavaScript

or ES6 equivalent:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement