Skip to content
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

Closed
bvaughn opened this issue Oct 6, 2017 · 2 comments
Closed

Missing documentation: null/undefined as input valu #16

bvaughn opened this issue Oct 6, 2017 · 2 comments

Comments

@bvaughn
Copy link
Contributor

bvaughn commented Oct 6, 2017

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 as value of an input, you get the following warning:

warning.js:33 Warning: value prop on select should not be null. Consider using the empty string to clear the component or undefined for uncontrolled components.

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:

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!

@fanny
Copy link

fanny commented Oct 6, 2017

I found this link that explains the problem: https://zhenyong.github.io/react/tips/controlled-input-null-value.html

@fanny
Copy link

fanny commented Oct 6, 2017

can I create a file that contains the link information in the docs folder?

@bvaughn bvaughn closed this as completed in b20566b Oct 7, 2017
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
Projects
None yet
Development

No branches or pull requests

2 participants