Skip to content

Instantly share code, notes, and snippets.

@kybernetikos
Created April 16, 2020 21:06
Show Gist options
  • Save kybernetikos/34e1c091306af6851962dc3e83aded2e to your computer and use it in GitHub Desktop.
Save kybernetikos/34e1c091306af6851962dc3e83aded2e to your computer and use it in GitHub Desktop.
React no build
<html>
<head>
<title>React</title>
<script type="application/javascript" crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script type="application/javascript" crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
<body>
<div id="root"></div>
<script type="application/javascript">
const custom = (render) => (props, ...children) => React.createElement(render, props, ...children);
const {div, h1} = new Proxy({}, {get: (target, tagName, _) => custom(tagName)})
const TitleComponent = custom((props) =>
h1({}, props.title)
);
const App = custom((props) =>
div({},
TitleComponent({title: "Interesting"})
)
);
const rootElement = document.getElementById('root');
ReactDOM.render(App(), rootElement);
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment