Function: Fragment()

Estimated reading time: less than 1 minute
function Fragment(props): Element

A JSX Fragment is used to return multiple elements from a component.

Parameters

props

PropsWithChildren<Pick<HtmlTag, "safe">>

Returns

Element

Example

// renders <div>1</div> and <div>2</div> without needing a wrapper element
const html = (
  <>
    <div>1</div>
    <div>2</div>
  </>
)

// Html.Fragment is the same as <>...</>
const html = (
  <Html.Fragment>
    <div>1</div>
    <div>2</div>
  </Html.Fragment>
)