on the homepage of React, there's the last example (A Component Using External Plugins) with a textarea
:
<textarea
id="markdown-content"
onChange={this.handleChange}
defaultValue={this.state.value}
/>
As I type, the textarea
gets updated.
Now, I tried to change defaultValue
with value
:
<textarea
id="markdown-content"
onChange={this.handleChange}
value={this.state.value}
/>
And the outcome is the same (as with defaultValue
, i.e. as I type, the textarea
gets updated visually with the updated text).
So, what is the real difference between the two?