-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Make invalid prop type warnings more specific if they are falsy #11289
Comments
I would like to take this issue on :) Just need a little direction as to where to start. |
Run the code above. See the emitted warning. Find it by message in the source. Then you can tweak the message to be more helpful. Does this help? |
Yes, thank you! |
Hi, I'm beginner too. I think the warning is located on the line 5724 in the react-dom.development.js file, correct me if I'm wrong.
|
That specific file is in your local node_modules directory when you install react-dom via npm. |
Yes. If you search the source code, though, you’ll find it here: |
Proposed fix. #11300 |
Fixed by #11308. |
This is a common pattern:
However if condition is
false
,0
or""
then this correctly warns.You should have used
condition ? ... : undefined
instead.We could suggest that more specifically in the warning.
The longer term alternative is to use the proposed more concise
??
operator.The text was updated successfully, but these errors were encountered: