1

I was reading a tutorial related to High Order Components in React and I found this:

save = () => {
   // some logic
}

What is the difference, if there is one, between the way above with the one I was familiar with:

methodName () {
   // some logic
}
Italo Borges
  • 2,355
  • 5
  • 34
  • 45
  • 3
    The difference is that the first named `save` and the second is `methodName`. Nothing in common! But if serious, read about class properties and arrow functions. The key here is context. – dfsq Aug 21 '18 at 12:17
  • Good one! haha Thanks, but do I need something special to use the first one? I'm getting a syntax error. I'm using babel with the last preset and react as well. – Italo Borges Aug 21 '18 at 12:22

0 Answers0