Method Fragment
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Fragment(VNode?[], string?)
Fragment node. Returns multiple nodes without an enclosing wrapper element.
When key is supplied, the Fragment's children participate in the
parent's keyed sibling list as a single keyed unit: their identity is scoped by
key so siblings under a Fragment with a different key do not collide,
and per-child fiber state (Hooks, refs) is preserved across reorders of the keyed
Fragments.
public static FragmentNode Fragment(VNode?[] children, string? key = null)
Parameters
childrenVNode[]Child VNodes returned as a flat sibling list.
keystringOptional key used to disambiguate the Fragment from siblings at the same position, held to Key's rule on what a key may contain.
Returns
- FragmentNode
The created FragmentNode.
Exceptions
- ArgumentException
Thrown when
keycontains a NUL character.
Fragment(params VNode?[])
Shorthand overload: variadic children and no key, the counterpart of JSX's
<>…</>. For a keyed Fragment, use the overload taking key.
public static FragmentNode Fragment(params VNode?[] children)
Parameters
childrenVNode[]Child VNodes; pass zero or more positionals or expand an existing array.
Returns
- FragmentNode
The created FragmentNode.