[TextField] Fix controlled input warning in React 15
See original GitHub issueProblem Description
I’m getting this error after upgrading to React 15 and MUI 0.15.0-beta.1
TextField is changing a uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa)
Versions
- Material-UI: 0.15.0-beta.1
- React: 15.0.1
- Browser: Google Chrome Canary (Version 52.0.2712.0 canary (64-bit))
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
[TextField] Fix controlled input warning in React 15 · Issue #4047
In React 15+, you will get a warning if you change the value prop of an input from undefined (uncontrolled) to a non-null...
Read more >Warning: TextField is changing a controlled input of type text ...
The solution for the issue is to remove the value attribute in textfield component or put null value in value attribute of component....
Read more >A component is changing an uncontrolled input to be controlled
The warning "A component is changing an uncontrolled input to be controlled" occurs when an input value is initialized to `undefined` but is...
Read more >a component is changing a controlled input to be uncontrolled ...
"Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a...
Read more >A component is changing an uncontrolled input to be controlled
A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In React 15+, you will get a warning if you change the value prop of an input from undefined (uncontrolled) to a non-null value (controlled). If you are seeing this warning, then it’s probably because you are not initializing value in your component state to an empty string.
I’d like to get this fixed to, I have the same issue, but I do not understand @abelosorio soution, could you explain more?