Skip to content

Instantly share code, notes, and snippets.

@trueadm
Last active July 8, 2016 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trueadm/6aa37eb6cfe97cd0d12a2848d19b1f33 to your computer and use it in GitHub Desktop.
Save trueadm/6aa37eb6cfe97cd0d12a2848d19b1f33 to your computer and use it in GitHub Desktop.
import { render, createView, html } from 'fusion';
const view = createView(({ name, age, location }) => html`
<div>
<header>About me</header>
<section class="about">
<div>My name: <span>${ name }</span></div>
<div>My age: <span>${ age }</span></div>
<div>My location: <span>${ location }</span></div>
</section>
</div>
`);
render(view('Dominic', 28, 'UK'), document.body);
const MyComponent = createComponent(function (props) {
return html`<div>Hello world</div>`;
});
render(html`
<div>
${ MyComponent({ items, counter },
MyComponent({ items, counter }),
MyComponent({ items, counter }), html`
<div>Foo</div>
<div>Foo</div>
`)}
</div>
`, document.body);
render(html`
import MyComponent from ${ MyComponent };
<div>
<MyComponent>,
<MyComponent />
<MyComponent />
<div>Foo</div>
<div>Foo</div>
</MyComponent>
</div>
`, document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment