When should I use `return` in es6 Arrow Functions?

后端 未结 5 2216
后悔当初
后悔当初 2020-11-21 05:40

The new es6 arrow functions say return is implicit under some circumstances:

The expression is also the implicit return value of that fun

5条回答
  •  执念已碎
    2020-11-21 06:06

    There's another case here.

    When writing a functional component in React, you can use parentheses to wrap implicitly returned JSX.

    const FunctionalComponent = () => (
      
    );

提交回复
热议问题