Skip to content

Instantly share code, notes, and snippets.

@johan-gorter
Last active February 8, 2016 20:54
Show Gist options
  • Save johan-gorter/7f1f9d028d8e0f407880 to your computer and use it in GitHub Desktop.
Save johan-gorter/7f1f9d028d8e0f407880 to your computer and use it in GitHub Desktop.
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