Last active
July 6, 2018 03:24
-
-
Save laniehei/c080cdbe8beb7bc5a7a21ae9717f7a90 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script src="node_modules/react/dist/react.js"></script> | |
<script src="node_modules/react-dom/dist/react-dom.js"></script> | |
<script> | |
const ce = React.createElement | |
const MyTitle = function (props) { | |
return ( | |
ce('div', null, | |
ce('h1', null, props.title) | |
) | |
) | |
} | |
const MyFirstComponent = function () { | |
return ce('div', { id: 'my-first-component' }, | |
[ce(MyTitle, { title: 'Game of Thrones' }), | |
ce(MyTitle, { title: 'Stranger Things' }), | |
ce(MyTitle, { title: 'Rick and Morty' }), | |
ce(MyTitle, { title: 'Silicon Valley' })] | |
) | |
} | |
ReactDOM.render( | |
ce(MyFirstComponent), | |
document.getElementById('app') | |
) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment