Created
January 24, 2020 22:42
-
-
Save pdkovacs/a1c8268e2e9db3433ef3b20b15a7ab6b to your computer and use it in GitHub Desktop.
"A component is changing a controlled input of type undefined to be uncontrolled"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React seems to monitor the `value` attributes that is being set to <input> elements and if it finds that the `value` is set to `undefined` emits the above warning. There are cases where figuring out what is happening may be tricky. But knowing that you have to look for `undefined` being set to `values` will help you a lot figure out how to have this warning go away. (An example of such a non-trivial situation is that you display the properties of an object in separate input elements. When the user starts setting the first property of the object, the other properties are still undefined, but a simple state management logic -- and you'll want to keep the state management logic simple, I bet -- will try to set all the input tags representing the properties of the object.) | |
The closest to give a clue I've found by Googling was this issue. Unfortunately, it uses the word "empty" instead of the `undefined` keyword. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment