-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_element-type.html
67 lines (52 loc) · 1.68 KB
/
04_element-type.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>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:300,300i,700,700i|Roboto:300,300i,700,700i" rel="stylesheet">
<link rel="stylesheet" href="css/react.css">
<script src="https://unpkg.com/react@latest/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel" data-presets="es2015,stage-2,react" data-plugins="transform-class-properties">
( function() {
/**
* MyComponent
*
* simple functional component that returns a div with text.
*
* @returns {Object} React element object
*/
const MyComponent = () => <div>my really simple react component</div>;
/**
* list of components
*
* using dot notation to create an element from a list of components.
* First letter needs to be capitalized.
*
* @type {Object}
*/
const Components = {
First : MyComponent,
Second()
{
return <div>Second</div>;
}
};
ReactDOM.render(
<div>
<MyComponent />
<div>html DIV element</div>
<Components.First />
<Components.Second />
</div>,
document.querySelector( '#root' )
);
}() )
</script>
</body>
</html>