Created
September 30, 2019 18:12
-
-
Save mikaelbr/7fbc94d0edc1c21a39c7e76bebb92d27 to your computer and use it in GitHub Desktop.
Code example from blogpost https://medium.com/variant-as/abstracting-the-dom-by-making-ad-hoc-react-like-library-1c9b42618e63
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
const { main, header, h1, h2 } = createUiFramework(); | |
// Create my component with a similar signature | |
let myHeader = (props, children) => | |
header(props, [children, h2("... a greeting blog")]); | |
// Use custom component | |
document.body.appendChild( | |
main({}, | |
myHeader({ class: "header" }, h1("Hello, world!"))) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment