Last active
January 31, 2017 16:02
-
-
Save joaolucasl/462d9dd066e38a51349b45dd6557d2eb to your computer and use it in GitHub Desktop.
VDOM THINGO
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
//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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
render(HelloWorld, root)