You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Reapplied fixes to updated docs from master
* Reapplied fixes to Forms, removed ES2016 function includes()
* Missing carriage return
* Adding back some line breaks
* Making requested changes.
* Making space changes
Copy file name to clipboardExpand all lines: docs/docs/forms.md
+31-25Lines changed: 31 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,11 @@ render() {
26
26
}
27
27
```
28
28
29
-
User input has no effect on the rendered element because React has declared the value to be "Hello!". To update the value in response to user input, you would use the onChange event:
29
+
User input has no effect on the rendered element because React has declared the value to be "Hello!".
30
30
31
-
```javascript
31
+
To update the value in response to user input, you would use the `onChange` event to save the new value, then pass that to the `value` prop of the form:
32
+
33
+
```javascript{10,22,23}
32
34
class Form extends React.Component {
33
35
constructor(props) {
34
36
super(props);
@@ -91,9 +93,9 @@ An **uncontrolled** component manages its own state.
91
93
}
92
94
```
93
95
94
-
If you wanted to listen to updates to the value, you could use the `onChange` event just like you can with controlled components.
96
+
If you wanted to listen to updates to the value, you could use the `onChange` event just like you can with controlled components. However, you would _not_ pass the value you saved to the component.
95
97
96
-
```javascript
98
+
```javascript{10,22}
97
99
class Form extends React.Component {
98
100
constructor(props) {
99
101
super(props);
@@ -115,7 +117,6 @@ class Form extends React.Component {
0 commit comments