Skip to content

Commit 69204d4

Browse files
committed
React source code.
1 parent 845c82a commit 69204d4

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

React/003_properties.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>thenewboston</title>
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
9+
</head>
10+
<body>
11+
12+
<div id="content"></div>
13+
14+
<script type="text/jsx">
15+
16+
var BuckysComponent = React.createClass({
17+
render: function() {
18+
return(
19+
<h2>{this.props.user} likes to eat {this.props.food}</h2>
20+
);
21+
}
22+
});
23+
24+
React.render(
25+
<div>
26+
<BuckysComponent user="Bucky" food="Bacon" />
27+
<BuckysComponent user="Sally" food="Tuna" />
28+
<BuckysComponent user="Emily" food="Beef" />
29+
<BuckysComponent user="Tony" food="Ham" />
30+
</div>,
31+
document.getElementById('content')
32+
);
33+
34+
</script>
35+
36+
</body>
37+
</html>

React/004_children.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>thenewboston</title>
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
9+
</head>
10+
<body>
11+
12+
<div id="content"></div>
13+
14+
<script type="text/jsx">
15+
16+
var BuckysComponent = React.createClass({
17+
render: function() {
18+
return(
19+
<div>
20+
<h3>{this.props.user}</h3>
21+
<p>{this.props.children}</p>
22+
</div>
23+
);
24+
}
25+
});
26+
27+
React.render(
28+
<div>
29+
<BuckysComponent user="Bucky">This guy is awesome</BuckysComponent>
30+
<BuckysComponent user="Emily">She smells like mints</BuckysComponent>
31+
</div>,
32+
document.getElementById('content')
33+
);
34+
35+
</script>
36+
37+
</body>
38+
</html>

React/005_events.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>thenewboston</title>
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
9+
</head>
10+
<body>
11+
12+
<div id="content"></div>
13+
14+
<script type="text/jsx">
15+
16+
var BuckysComponent = React.createClass({
17+
doSomething: function() {
18+
alert("The text displaying is: " + this.props.children);
19+
},
20+
render: function() {
21+
return(
22+
<div>
23+
<h3>{this.props.user}</h3>
24+
<a onClick={this.doSomething} href="#" >Click me</a>
25+
</div>
26+
);
27+
}
28+
});
29+
30+
React.render(
31+
<div>
32+
<BuckysComponent user="Bucky">This guy is awesome</BuckysComponent>
33+
<BuckysComponent user="Emily">She smells like mints</BuckysComponent>
34+
</div>,
35+
document.getElementById('content')
36+
);
37+
38+
</script>
39+
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)