forked from dylan-cancelliere/learning-react-book
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathintro_to_components.html
39 lines (35 loc) · 1.06 KB
/
intro_to_components.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Components</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/babel">
class HelloWorld extends React.Component {
render(){
return <p>Hello, {this.props.greetTarget}!</p>
}
}
class Buttonify extends React.Component{
render() {
return (
<div>
<button type={this.props.behavior}>{this.props.children}</button>
</div>
);
}
}
ReactDOM.render(
<div>
<Buttonify behavior="submit">SEND DATA</Buttonify>
</div>,
document.querySelector("#container")
);
</script>
</body>
</html>