-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex3.html
36 lines (32 loc) · 916 Bytes
/
ex3.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
<!DOCTYPE html>
<html>
<head>
<script src="./lib/react.js"></script>
<script src="./lib/JSXTransformer.js"></script>
<link rel="stylesheet" type="text/css" href="./lib/bootstrap.min.css">
</head>
<body>
<div id="app"></div>
<script type="text/jsx">
var ClickCounter = React.createClass({
getInitialState: function() {
return {
clickCount: 0
};
},
increment: function() {
this.setState({
clickCount: this.state.clickCount + 1
});
},
render: function() {
return <div>
<p>Clicks: {this.state.clickCount}</p>
<button onClick={this.increment}>Increment</button>
</div>;
}
});
React.render(<ClickCounter/>, document.getElementById("app"));
</script>
</body>
</html>