U
U
Urgaming2020-06-07 13:32:14
React
Urgaming, 2020-06-07 13:32:14

How to hang multiple events on onclick?

Beginner in react.
In js it would look like what I want to achieve

<span class="active" onclick="func1;func2;">1</span>


How to do this in react? to trigger two events on click

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Kim, 2020-06-07
@Urgaming

Good afternoon. Why not combine these functions into one? That is, you have a function

handleClick = () => {
         //do function 1
        // do function 2
    }

<span className="active" onclick={this.handleClick}>1</span>

Here you can read how events are handled in react. I just don't know how you have it in the code itself. You use functional components, or classes, depending on this, the syntax will change a little there. But the essence remains the same.
I think it's better to combine them. Here is the implementation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question