File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 11var React = require ( 'react' ) ;
22
33module . 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} ) ;
You can’t perform that action at this time.
0 commit comments