-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday1.html
46 lines (35 loc) · 1.29 KB
/
day1.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<!-- 生产环境中不建议使用 -->
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
<div id="example">
</div>
<div id="app"></div>
<script type="text/babel">
// let text=document.getElementById('example')s
ReactDOM.render(
<h1>你好 react 垃圾</h1>,document.getElementById('example')
)
// 2创建react元素
// 参数一 元素名称
// 参数二 元素对象 (对象格式)
// 参数三 元素子节点 可以继续用render 创建节点
const title =React.createElement(
'p',{title:"我是标题",id:'p1'},'hello world'
)
// 3 渲染dom
// 参数一 要渲染的doma元素
// 参数二 挂载点
ReactDOM.render(title,document.getElementById('root'))
</script>
</body>
</html>