Arrow function without curly braces

前端 未结 7 1162
生来不讨喜
生来不讨喜 2020-11-22 10:52

I\'m new to both ES6 and React and I keep seeing arrow functions. Why is it that some arrow functions use curly braces after the fat arrow and some use parentheses? For exam

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 11:22

    Parenthesis has an implicit return statement while curly braces you need an explicit return statement

提交回复
热议问题