I
I
Ivan2019-08-19 21:01:38
React
Ivan, 2019-08-19 21:01:38

What is the best way to handle events in React?

Which method is suitable for frequent use? Through bind, arrow functions, or what does React itself call " public class field syntax " and through a dash indicate that this is an experimental syntax? I also read about the package react-autobind, maybe it's better to use it at all and then there will be 100% clean code? It's just that, as I understand it, using constructors is an old topic. I started learning React recently.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-08-19
@BenderIsGreat34

Use arrow functions in class properties. They are the unspoken standard in React development and are likely to become standard very soon. We have already reached stage-3, and Chrome already has native support.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question