Skip to content

Instantly share code, notes, and snippets.

@rbiggs
Last active September 5, 2017 22:30
Show Gist options
  • Save rbiggs/520b4609f8b3ef1d26131154a830dcd9 to your computer and use it in GitHub Desktop.
Save rbiggs/520b4609f8b3ef1d26131154a830dcd9 to your computer and use it in GitHub Desktop.
Creating Composi Component without JSX: Hyperscript
import {h, Component, injectElement} from 'composi'
// Define hyperscript functions:
function Welcome(props) {
return h('h1', {}, `Hello, ${props.name}.`)
}
function App() {
return h(
'div', {}, [
Welcome({name: 'Sara'}),
Welcome({name: 'Charlie'}),
Welcome({name: 'Dave'})
]
)
}
// Append tags to body:
injectElement(App(), 'body')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment