-
Notifications
You must be signed in to change notification settings - Fork 815
Closed
Description
JSX fragments allows to have several nodes at the root level without returning an array.
It is now part of the JSX spec, and has some advantages:
return (<>
<div>node</div>
{this.condition && <div>now visible</div>}
</>);
VS
return [
<div>node</div>,
this.condition && <div>now visible</div>,
];
Right now, refactoring JSX can be tricky when nodes move from the root to a nested position, JSX fragments makes the syntax for nodes at the top the same as nested nodes.
VS code support since October 2017:
microsoft/TypeScript#19249
Metadata
Metadata
Assignees
Labels
No labels