Closed
Description
The JSX spec has been updated to support Fragments, which are a shorthand syntax for using a specific opaque class from the React package. Spec PR is at facebook/jsx#93.
Fragments are written by completely empty tags (only whitespace is allowed between <
and >
), and look like <>{'child1'}{'child2'}{'child3'}</>
. This is not written down in the PR's text itself as it is only an AST update, but according to facebook/jsx#93 (comment) it should desugar to <React.Fragment>{'child1'}{'child2'}{'child3'}</React.Fragment>
.
The intent is to make returning multiple elements from a component more ergonomic -- instead of returning an array where each child needs to be keyed, return a fragment that preserves the optional key reconciling behavior.