-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_d1.html
47 lines (41 loc) · 1.04 KB
/
index_d1.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head>
<title>First React App</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
<div id='app'></div>
<script type='text/babel'>
const name = 'Vincent'
const handle = '@vchiangster'
function NameComponent (props) {
return <h1>{props.name}</h1>
}
function HandleComponent (props) {
return <h1>{props.handle}</h1>
}
function
function App () {
return (
<div id='container'>
<NameComponent name={name} />
<HandleComponent handle={handle} />
</div>
)
}
const wrapperElement = React.createElement(
'div',
{id: 'container'},
React.createElement(NameComponent, {name: 'Vincent'}),
React.createElement(HandleComponent, {handle: '@vchiangster'})
)
ReactDOM.render(
wrapperElement,
document.getElementById('app')
)
</script>
</body>
</html>