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
Missing documentation: null/undefined as input valu #16
Comments
I found this link that explains the problem: https://zhenyong.github.io/react/tips/controlled-input-null-value.html |
can I create a file that contains the link information in the docs folder? |
bvaughn
added a commit
that referenced
this issue
Oct 7, 2017
fix #16 missing documentation: null/undefined as input value
gaearon
added a commit
to gaearon/reactjs.org
that referenced
this issue
Feb 9, 2019
jhonmike
pushed a commit
to jhonmike/reactjs.org
that referenced
this issue
Jul 1, 2020
BetterZxx
pushed a commit
to BetterZxx/react.dev
that referenced
this issue
Mar 21, 2023
BetterZxx
pushed a commit
to BetterZxx/react.dev
that referenced
this issue
Mar 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally filed by @DanielSWolf via facebook/react/issues/11031
Do you want to request a feature or report a bug?
I'd like to request documentation. :-)
When you pass
null
asvalue
of an input, you get the following warning:This warning very clearly states what to do. My problem is, it fails to mention why I'm not supposed to pass
null
. Nor could I find any explanation online:null
.value={undefined}
is not controlled component" adds the following documentation: "Similarly to not setting thevalue
attribute at all, setting it tonull
orundefined
will make React assume the component is not controlled and may produce a warning." But again, there is no explanation as to why React behaves this way.Naively, I'd expect
null
to be a perfectly valid value, e.g. for a numeric input that is empty. Passing an empty string to indicate the absence of a numeric value seems odd to me. So I'd really like some more information in the documentation!The text was updated successfully, but these errors were encountered: