Skip to content

Commit 952235f

Browse files
committed
Firebase - Section 6
1 parent 74f393e commit 952235f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

todos/src/header.jsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
var React = require('react');
22

33
module.exports = React.createClass({
4+
getInitialState: function() {
5+
return {
6+
text: ''
7+
}
8+
},
49
render: function() {
510
return <div className="input-group">
6-
<input type="text" className="form-control" />
11+
<input
12+
value={this.state.text}
13+
onChange={this.handleInputChange}
14+
type="text"
15+
className="form-control" />
716
<span className="input-group-btn">
8-
<button className="btn btn-default" type="button">
17+
<button
18+
onClick={this.handleClick}
19+
className="btn btn-default"
20+
type="button">
921
Add
1022
</button>
1123
</span>
1224
</div>
25+
},
26+
handleClick: function() {
27+
console.log(this.state.text);
28+
},
29+
handleInputChange: function(event) {
30+
this.setState({text: event.target.value});
1331
}
1432
});

0 commit comments

Comments
 (0)