Fanny Vieira
7 years ago
3 changed files with 19 additions and 20 deletions
@ -1,19 +0,0 @@ |
|||||
--- |
|
||||
id: controlled-input-null-value |
|
||||
title: Controlled input null value |
|
||||
permalink: docs/controlled-input-null-value.html |
|
||||
--- |
|
||||
|
|
||||
Specifying the value prop on a [controlled component](/docs/forms.html) prevents the user from changing the input unless you desire so. |
|
||||
|
|
||||
You might have run into a problem where value is specified, but the input can still be changed without consent. In this case, you might have accidentally set value to undefined or null. |
|
||||
|
|
||||
For example, this code shows this phenomenon; after a second, the text becomes editable. |
|
||||
```javascript |
|
||||
ReactDOM.render(<input value="hi" />, mountNode); |
|
||||
|
|
||||
setTimeout(function() { |
|
||||
ReactDOM.render(<input value={null} />, mountNode); |
|
||||
}, 1000); |
|
||||
|
|
||||
``` |
|
@ -1 +1,2 @@ |
|||||
/html-jsx.html http://magic.reactjs.net/htmltojsx.htm 301 |
/html-jsx.html http://magic.reactjs.net/htmltojsx.htm 301 |
||||
|
/tips/controlled-input-null-value.html /docs/forms.html#controlled-components |
Loading…
Reference in new issue