-
Notifications
You must be signed in to change notification settings - Fork 0
/
reactt.html
67 lines (66 loc) · 2.19 KB
/
reactt.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
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React complex components</title>
<script crossdomain src="https://unpkg.com/react@16/umd/react.development.js"> </script>
<script crossdomain src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"> </script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"> </script>
</head>
<!-- Different ways to style React Components
• Inline CSS - using style attribute
• CSS in JS - Using Libraries JSS and Styled Components
• CSS modules – css loader and Sass & SCSS
• Stylable-->
<body>
<div id="container"></div>
<script type="text/babel">
class SrchResult extends React.Component {
render() {
return (
<div>
<ResImage/>
<ResCaption/>
<ResLink/>
</div>
);
}
}
class ResImage extends React.Component
{
render() {
return (
<div>
<img src="lion.jpeg"></img>
</div>
);
}
}
class ResLink extends React.Component {
render() {
return (
<div>
<a href="https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.britannica.com%2Fanimal%2Flion&psig=AOvVaw3cteA702BzW7Gy8ePMsxyX&ust=1696487413076000&source=images&cd=vfe&ved=0CBIQjhxqFwoTCJDYkLfi24EDFQAAAAAdAAAAABAH">link</a>
</div>
);
}
}
class ResCaption extends React.Component {
render() {
return (
<div>
<p>Lion | Characteristics, Habitat, & Facts | Britannica</p>
</div>
);
}
}
ReactDOM.render (
<div>
<SrchResult
/>
</div>,document.getElementById('container')
);
</script>
</body>
</html>