Components as Arrow Functions0:55 with Guil Hernandez
You'll often see components defined as arrow functions. Even though there's no real benefit to writing a component as an arrow function, it provides a more concise syntax.
You´ll often see components defined as arrow functions. 0:00 For example, I´ll convert the Header function declaration to an arrow function 0:03 expression. 0:08 If you´re writing a simple function that just returns JSX, 0:12 like this one, you can use an implicit return. 0:16 You omit the curly braces and the return keyword and 0:19 leave the opening and closing parentheses to wrap your JSX. 0:23 As you learned earlier, including parentheses around JSX is optional, so 0:28 you may see components simplified even further without the parentheses. 0:33 There's no real benefit to writing components as arrow functions, 0:38 it just provides a more concise syntax. 0:42 You can use either approach, I'm going to stick with the arrow function 0:45 syntax with the curly braces and return keyword. 0:49
You need to sign up for Treehouse in order to download course files.Sign up