JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id='root'>
</div>
</body>
Babel + JSX
/* @jsx h */
function h(type, props, ...args) {
const children = args.length ? [].concat(...args) : null;
return {
type,
props,
children
}
}
const helloWorld = <div className = 'hello' > Hello, world!</div>
function createElement(node) {
if (typeof node === 'string') {
return document.createTextNode(node)
}
const element = document.createElement(node.type)
node.children
.map(createElement)
.forEach(child => element.appendChild(child))
return element
}
document.getElementById('root')
.appendChild(createElement(helloWorld))