-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-js.html
31 lines (24 loc) · 884 Bytes
/
01-js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<div id="root"></div>
<script src="http://unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script src="http://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
<script type="text/javascript">
const rootElement = document.getElementById('root')
// With JS
// const domElement = document.createElement('div')
// domElement.textContent = 'Hello World'
// domElement.className = 'container'
// rootElement.appendChild(domElement)
// const domElement = React.createElement(
// 'div', //element type
// {className: 'container'}, //props
// 'Hello World', //children prop
// 'Goodbye World' //children prop
// )
const domElement = React.createElement(
'div', //element type
{className: 'container', //props
children: ['Hello World', 'Goodbye World']}, //props
)
console.log(domElement)
ReactDOM.render(domElement, rootElement)
</script>