Created
October 8, 2019 19:56
-
-
Save mikaelbr/dff1babd6197aa026a392db39354468f to your computer and use it in GitHub Desktop.
Code for blogpost "Using JSX for your own lightweight declarative library": https://medium.com/@mikaelbrevik/using-jsx-for-your-own-lightweight-declarative-library-a773d3796475
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
function createElement(tag, props, ...children) { | |
// Create a new html node element. | |
const el = document.createElement(tag); | |
// just take the first child for now | |
el.textContent = children[0]; | |
return el; | |
} | |
const h1 = <h1>Hello, World</h1>; | |
//> <h1>Hello, World</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment