-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_display_dynamic_data.html
More file actions
89 lines (67 loc) · 2.21 KB
/
04_display_dynamic_data.html
File metadata and controls
89 lines (67 loc) · 2.21 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!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>React JS Compoenetn | Linkedin Learning</title>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
function Header(props) {
return (
<header>
<h1>{ props.name } Kitchen</h1>
</header>
);
}
function Main(props) {
return (
<section>
<img
height={200}
alt="A server presents tow plates"
src="https://images.pexels.com/photos/262978/pexels-photo-262978.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" />
<ul>
{ props.dishes.map((dish, i) => (<li key={dish.id}> {dish.title} </li>))}
</ul>
</section>
);
}
const dishes = [
"Black Bean Soup",
"Macaroni and Cheese",
"Salmon and Potatoes",
"Pizza"
];
const dishObjects = dishes.map((dish, i) => ({
id: i,
title: dish
}));
function App() {
return (
<React.Fragment>
<Header name="Avinash"/>
<Main adjective="amazing" dishes={dishObjects}/>
<Footer year={ new Date().getFullYear() }/>
</React.Fragment>
);
}
function Footer(props) {
return (
<footer>
<p>Copyright { props.year }</p>
</footer>
);
}
ReactDOM.render(
<App />,
document.getElementById("root")
);
</script>
</body>
</html>