Skip to content

Instantly share code, notes, and snippets.

@joaolucasl
Last active January 31, 2017 16:02
Show Gist options
  • Save joaolucasl/462d9dd066e38a51349b45dd6557d2eb to your computer and use it in GitHub Desktop.
Save joaolucasl/462d9dd066e38a51349b45dd6557d2eb to your computer and use it in GitHub Desktop.
VDOM THINGO
//Criar um micro-framework simples que forneça a seguinte API:
// Cria um nó virtual que é utilizado na função render
function h(tagName, props, children) {}
// Recebe um nó virtual e um nó do DOM e renderiza o elemento dentro desse nó.
function render(vNode, domNode) {}
// Exemplo:
import { h, render } from './build.js'
const root = document.getElementById('root')
const HelloWorld = h('div', { 'height': 300 }, [
h('h1', { 'class': 'titulo1' }, 'HELLO'),
h('h2', { 'id': 'titulo2' }, 'WORLD'),
])
render(HelloWorld, root)
@felquis
Copy link

felquis commented Jan 31, 2017

render(HelloWorld, root)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment