Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 636 Bytes

cpx-fragments.md

File metadata and controls

34 lines (28 loc) · 636 Bytes
id title
cpx-fragments
Fragments

DocumentFragments can be written using a special selector Fragment:

<Fragment>
	<div>Div content</div>
  Hello World!
</Fragment>

In this way you can group a list of children without adding extra nodes to the DOM.

// this cannot be done
/* asmdom::VNode* vnode = (
	<div>Child 1</div>
	<div>Child 2</div>
	<div>Child 3</div>
); */

// this is a valid alternative to the code above
asmdom::VNode* vnode = (
	<Fragment>
		<div>Child 1</div>
		<div>Child 2</div>
		<div>Child 3</div>
	</Fragment>
);