Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
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.
For example, I´ll convert the Header function declaration to an arrow function
If you´re writing a simple function that just returns JSX,
like this one, you can use an implicit return.
You omit the curly braces and the return keyword and
leave the opening and closing parentheses to wrap your JSX.
As you learned earlier, including parentheses around JSX is optional, so
you may see components simplified even further without the parentheses.
There's no real benefit to writing components as arrow functions,
it just provides a more concise syntax.
You can use either approach, I'm going to stick with the arrow function
syntax with the curly braces and return keyword.
You need to sign up for Treehouse in order to download course files.Sign up