react/docs/tips/08-controlled-input-null-value.md
Cheng Lou 1b3b432d64 [Docs] Remove most of @jsx
I kept some places intact (search for @jsx) because they require other bigger changes:

- ref-01-top-level-api.md
- grunt/tasks/npm.js
- old blog posts (don't change those)
- examples/ folder, as they have their own package.json that rely on old dependencies (node-jsx, reactify) that haven't upgraded to 0.12
2014-10-20 14:44:07 -04:00

823 B

id title layout permalink prev next
controlled-input-null-value Value of null for Controlled Input tips controlled-input-null-value.html children-props-type.html componentWillReceiveProps-not-triggered-after-mounting.html

Specifying the value prop on a controlled component 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.

The snippet below shows this phenomenon; after a second, the text becomes editable.

React.renderComponent(<input value="hi" />, mountNode);

setTimeout(function() {
  React.renderComponent(<input value={null} />, mountNode);
}, 1000);