Created
April 16, 2020 21:06
-
-
Save kybernetikos/34e1c091306af6851962dc3e83aded2e to your computer and use it in GitHub Desktop.
React no build
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
<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