Skip to content

feat(render): support JSX fragment #534

@manucorporat

Description

@manucorporat

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions