0

Having this confusion with react-native (javascript) function declaration

_onclick = (resp) => { //some functions }

and,

_onclick(resp){ //some functions }

what is the difference between both declarations? or they are actually the same?

nobody99
  • 105
  • 1
  • 1
  • 9
  • 2
    @Rajesh Not the same really. – Andrew Li Dec 13 '18 at 07:03
  • Hi, @Li357can you further explain the difference? What i does understand is if i declared _onclick(resp), the function will need at least 1 parameter to represent resp but on the other hand _onclick = (resp) => is a bit confused to me about the logic – nobody99 Dec 13 '18 at 07:06
  • @Li357 I beg to differ but I have retracted my vote – Rajesh Dec 13 '18 at 07:08
  • @Rajesh This asks about the difference of class property arrow functions vs methods. Your dupe only deals with function expressions not arrow functions specifically. I know there's a better dupe – Andrew Li Dec 13 '18 at 07:09
  • @Li357 The answer you picked isn't really a dupe either – ic3b3rg Dec 13 '18 at 07:15

0 Answers0