docs `select` `value` to control chosen option
Cheng Lou committed
Nov 20, 2013 at 21:12 UTC
0a3d0163d00e1d7bdec3de048fdafd066ff2588d
1 file changed
+15
docs/docs/06-forms.md
+15
@@ -130,3 +130,18 @@ For HTML, this easily allows developers to supply multiline values. However, sin
130
```
131
132
If you *do* decide to use children, they will behave like `defaultValue`.
133
+
134
+
135
+### Why Select Value?
136
+
137
+The selected `<option>` in an HTML `<select>` is normally specified through that option's `selected` attribute. In React, in order to make components easier to manipulate, the following format is adopted instead:
138
+
139
+```javascript
140
+ <select value="B">
141
+ <option value="A">Apple</option>
142
+ <option value="B">Banana</option>
143
+ <option value="C">Cranberry</option>
144
+ </select>
145
+```
146
+
147
+To make an uncontrolled component, `defaultValue` is used instead.