Rate this page:
Fragments return a list of components. Similar to React’s Fragment. Because a function can only return one top-level component, it is used for wrapping a list of top-level components.
1
import ForgeUI, { Fragment } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<ForgeComponent> | Yes | A container for displaying multiple components. Can contain any UI kit component. |
Using a Fragment to return multiple components.
1 2 3 4 5 6
const App = () => (
<Fragment>
<Text>Hello world!</Text>
<Button text="Do something" onClick={onClick} />
</Fragment>
);
Rate this page: