UNPKG

978 BJavaScriptView Raw
1/**
2 * Returns a group of siblings elements for inclusion in another JSX tag.
3 * @typedef {import('./vnode').Props} Props
4 * @typedef {import('./vnode').Children} Children
5 * @param {Props} props
6 * @return {Children} children
7 */
8/**
9 * A tag to enable returning sibling elements. This is useful for returning list items to render in a list or table cells to render in a table row.
10 * @example
11 *
12 * ```
13 * <Fragment>
14 * <li>A</li>
15 * <li>B</li>
16 * <li>C</li>
17 * </Fragment>
18 ```
19 * Or functionally:
20 * ```
21 * Fragment(null, [
22 * h('li', {}, 'A'),
23 * h('li', {}, 'B'),
24 * h('li', {}, 'C')
25 * ])
26 ```
27 * @param {Object} [props] When using Fragment as a function, props is the first argument. Provide either null or {} as the value for props.
28 * @param {Children} [children] The siblings to return with the Fragment. This will be an array of sibling elements.
29 * @return {VNode[]} An array of virtual nodes.
30 */
31export const Fragment = (props, children) => children