Skip to content

Support asm-dom@0.6.0, Fragment and ref

Latest
Compare
Choose a tag to compare
@mbasso mbasso released this 19 Jun 07:52
· 1 commit to master since this release

This release contains 2 features to support asm-dom@0.6.0

ref

refs are automatically converted to callbacks, you don't need to use parentheses:

<button ref={callback} />

// is equal to
<button (ref)={callback}>

Fragment

We support DocumentFragments 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>
);