-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Uncontrolled <textarea/> ignores setState() #1986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You should always treat state like private instance variables and should never call |
I can see that this is a closed issue, but: |
@codrin-iftimie instance.refs.textarea.getDOMNode().value = 'something new'; In your controlled example you need to change the value of the component (not refs.textarea): instance.state.value = 'something new';
instance.forceUpdate(); |
Oh my bad. Cool. Thanks |
This is better as |
Calling
setState()
for uncontrolledtextarea
, does not lead to the expected result. In the example http://jsfiddle.net/c88aK/ pressing the buttonReset state
should reset the state of the input fields to their default values. Elementinput
is resets as expected,textarea
not. In the debugger, methodtextarea .render ()
gets the correct initial data, but changes in the DOM does not occur.Is this a bug in the implementation of the
textarea.render()
or I do not correctly understand the essence of uncontrolled input fields?In any case, as I should reset the value of
textarea
on the initial state?The text was updated successfully, but these errors were encountered: