@samitouri / QOS-React-2 / commits / 14580fb012

Update refs example code to use onChange

Fixes #1408. Test Plan: Copy each code snippet into jsbin; type in the text box successfully; click the button and see the input clear (and in the second example, get focused).

Ben Alpert committed Apr 14, 2014 at 16:22 UTC 14580fb01209c1424797c1cdb03a00ca71681841
1 file changed +4 -4
docs/docs/07.1-more-about-refs.md
+4 -4
@@ -15,7 +15,7 @@ Consider the case when you wish to tell an `<input />` element (that exists with
15 getInitialState: function() {
16 return {userInput: ''};
17 },
18 - handleKeyUp: function(e) {
18 + handleChange: function(e) {
19 this.setState({userInput: e.target.value});
20 },
21 clearAndFocusInput: function() {
@@ -30,7 +30,7 @@ Consider the case when you wish to tell an `<input />` element (that exists with
30 </div>
31 <input
32 value={this.state.userInput}
33 - onKeyUp={this.handleKeyUp}
33 + onChange={this.handleChange}
34 />
35 </div>
36 );
@@ -91,7 +91,7 @@ It's as simple as:
91 getInitialState: function() {
92 return {userInput: ''};
93 },
94 - handleKeyUp: function(e) {
94 + handleChange: function(e) {
95 this.setState({userInput: e.target.value});
96 },
97 clearAndFocusInput: function() {
@@ -107,7 +107,7 @@ It's as simple as:
107 <input
108 ref="theInput"
109 value={this.state.userInput}
110 - onKeyUp={this.handleKeyUp}
110 + onChange={this.handleChange}
111 />
112 </div>
113 );