-
Notifications
You must be signed in to change notification settings - Fork 1
/
index6-2.html
63 lines (38 loc) · 1.39 KB
/
index6-2.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<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>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="react.development.js" ></script>
<script src="react-dom.development.js" ></script>
<script src="babel.min.js" ></script>
</head>
<body>
<div id="root">
</div>
<script type="text/babel">
//class
//function
//props
//state
class Comment extends React.Component{
render(){
console.log(this.props);
return <div style={{border:'1px solid red',padding:'10px'}} >New comment:{this.props.fullname}</div>;
}
}
function CommentFunction(props){
console.log(props);
return <div style={{border:'1px solid blue',padding:'10px'}} >New comment:{props.fullname}</div>;
}
const jsx = <div>
<Comment fullname="ali" />
<CommentFunction fullname="reza" />
<Comment fullname="hasan"/>
</div>
ReactDOM.render(jsx,document.getElementById('root'));
</script>
</body>
</html>