Last active
February 8, 2016 20:54
-
-
Save johan-gorter/7f1f9d028d8e0f407880 to your computer and use it in GitHub Desktop.
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 {createTextInput} from './components/text-input' | |
import * as maquette from 'maquette'; | |
const h = maquette.h; | |
let name = ''; // Piece of data | |
let nameInput = createTextInput({ | |
placeholder: 'What is your name?', | |
getValue: () => name, | |
setValue: (value: string) => {name = value;} | |
}); | |
// This function uses the 'JSX' notation | |
// to create the virtual DOM. | |
export function renderMaquette() { | |
return <div> | |
{ nameInput.renderMaquette() } | |
<p class="output"> | |
Hello {name || 'you'}! | |
</p> | |
</div>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment