Z
Z
zwezew2019-03-02 23:27:39
React
zwezew, 2019-03-02 23:27:39

Two functions, one via a condition, on a React event?

Is it possible to pass two different functions to the React event handler, for example, on hover, so that one is executed through a condition?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-03-02
@zwezew

There are synthetic ivens in React, and they are hung through properties, so you can’t hang two functions, but you can hang one callback, and branch inside it.
2) There is an option to hang up native events through creating a link and AddEventListener, but this can be a complete ass, because you don’t know at what moment to unsubscribe from the event

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question