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
  • 6,426
  • 7
  • 49
  • 72
olegzhermal
  • 703
  • 9
  • 19

0 Answers0