Last active
September 5, 2017 22:30
-
-
Save rbiggs/520b4609f8b3ef1d26131154a830dcd9 to your computer and use it in GitHub Desktop.
Creating Composi Component without JSX: Hyperscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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