-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfirst-component1-start.html
More file actions
44 lines (42 loc) · 1.28 KB
/
first-component1-start.html
File metadata and controls
44 lines (42 loc) · 1.28 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Component 1</title>
<link rel="stylesheet" href="first-component.css">
<script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
class HobbyList extends React.Component {
render(){
const liStyle = {
fontSize: "1.5em",
};
const hobbyList = ["Sleeping","Eating","Cuddling"];
return(
<ul>
{hobbyList.map((h,i) => <li key={i} style={liStyle}>{h}</li>)}
</ul>
);
}
}
class Pet extends React.Component {
render(){
return(
<div className="card">
<h2 className="name">Moxie</h2>
<img src="https://github.com/tigarcia/Moxie/raw/master/moxie.png" alt="moxie my cat" />
<h5 style={{fontSize:"2em",margin:"2px"}}>Hobbies:</h5>
<HobbyList />
</div>
)
}
}
ReactDOM.render(<Pet />,document.getElementById("app"))
</script>
</body>
</html>