-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGreeter.html
49 lines (44 loc) · 1.04 KB
/
Greeter.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>ReactJS </title>
<script src="react.js"></script>
<script src="react-dom.js"></script>
<script src="browser.min.js"></script>
<style>
input {
margin : 10px;
}
</style>
</head>
<body>
<script type="text/babel">
var Greeter = React.createClass({
getInitialState : function(){
return {
message : '[Default Message]'
}
},
greet : function(){
console.log('this ', this);
var message = 'Hi ' + this.refs.txtName.value + ' have a nice day !'
this.setState({
message : message
})
},
render : function(){
return (<div>
<label>Name : </label>
<input type="text" ref="txtName"/>
<input type="text" ref="abc"/>
<input type="button" value="Greet" onClick={this.greet}/>
<div>{this.state.message}</div>
</div>);
}
});
ReactDOM.render(<Greeter />, document.body);
</script>
<!-- ReactDOM.render(<Content title="Welcome to React" message="Hey You"/>, document.body); -->
</body>
</html>