Skip to content

Instantly share code, notes, and snippets.

@pomber
Created April 26, 2017 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pomber/1ceaa171a8c7702ab01e8b8c9b604012 to your computer and use it in GitHub Desktop.
Save pomber/1ceaa171a8c7702ab01e8b8c9b604012 to your computer and use it in GitHub Desktop.
function render(element, parentDom) {
const { type, props } = element;
const dom = document.createElement(type);
const childElements = props.children || [];
childElements.forEach(childElement => render(childElement, dom));
parentDom.appendChild(dom);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment