0

In react a couple of ways of passing a parameter to an event handler or callback are encountered:

onClick={(e) => handler1(parameter)}

And

onClick={handler2(parameter)}

Where handler2 is usually declared as the component method:

handler2 = (parameter) => (e) => { ... }

Which syntax is better and why? (My guess is that does not matter) Which do you personally prefer and Why?

Greeso
  • 7,544
  • 9
  • 51
  • 77
olegzhermal
  • 799
  • 10
  • 26

0 Answers0