-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitterSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
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.
hzoo, jwbay, sebald, deamme, EmmaRamirez and 8 more
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitterSuggestionAn idea for TypeScriptAn idea for TypeScript