Skip to content

Commit d5e376a

Browse files
committed
feat(react): add Fragment component to create a container without extra DOM elements
1 parent 2a80e90 commit d5e376a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/components/react.node.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
import { Activity as BaseActivity, Suspense as BaseSuspense } from 'react'
1+
import { Fragment as BaseFragment, Activity as BaseActivity, Suspense as BaseSuspense } from 'react'
22
import { createNode } from '@src/core.node.js'
33

4+
/**
5+
* A container that does not render any extra DOM element.
6+
* @see {@link https://react.dev/reference/react/Fragment React Docs}
7+
* @example
8+
*
9+
* ```typescript
10+
* import { Fragment, Div, Span } from '@meonode/ui';
11+
*
12+
* Fragment({
13+
* children: [
14+
* Div('First Div'),
15+
* Span('A Span inside Fragment'),
16+
* Div('Second Div'),
17+
* ],
18+
* })
19+
* ```
20+
*/
21+
export const Fragment = createNode(BaseFragment)
22+
423
/**
524
* Lets you hide and restore the UI and internal state of its children.
625
* @see {@link https://react.dev/reference/react/Activity React Docs}

0 commit comments

Comments
 (0)