Skip to content
Search

React:Fragments

lastmod 2025-10-11created 2022-11-094 edits

For returning a component with multiple roots.

About

In React, the following syntax:

<React.Fragment>
// your code
</React.Fragment>

is equivalent to:

<>
// your code 
</>

This is a shorthand syntax (syntactic sugar). What it basically means is that every component must be wrapped in a parent element.

See also

Favorite site

author Zer0 sitemap