Why not put an opening container element tag after the return keyword instead of an opening parentheses?

Question

Why not put an opening container element tag after the return keyword instead of an opening parentheses?

Answer

Although using an opening container element tag after the return statement will work, given that the first opening tag belongs to the same element as the final closing tag of the JSX expression and the first opening tag follows the return statement on the same line, it can make our code harder to read, it can make it less organized, and if we forget to put the first opening tag on the same line as the return statement, the JavaScript engine will automatically insert a semicolon after the return statement and will not return our component, but will instead stop executing the render() function.

8 Likes

is <> an open container tag?

2 Likes

I think it’s {}