mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 11:52:00 +00:00
More explicit docs about uncontrolled forms. (#3382)
This commit is contained in:
committed by
GitHub
parent
9b8dee54f2
commit
a9239a586e
@@ -45,7 +45,7 @@ If it's still not clear which type of component you should use for a particular
|
||||
|
||||
### Default Values {#default-values}
|
||||
|
||||
In the React rendering lifecycle, the `value` attribute on form elements will override the value in the DOM. With an uncontrolled component, you often want React to specify the initial value, but leave subsequent updates uncontrolled. To handle this case, you can specify a `defaultValue` attribute instead of `value`.
|
||||
In the React rendering lifecycle, the `value` attribute on form elements will override the value in the DOM. With an uncontrolled component, you often want React to specify the initial value, but leave subsequent updates uncontrolled. To handle this case, you can specify a `defaultValue` attribute instead of `value`. Changing the value of `defaultValue` attribute after a component has mounted will not cause any update of the value in the DOM.
|
||||
|
||||
```javascript{7}
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user