-
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
Is there a way to let users know which invalid type was returned? #7215
Comments
@kevinSuttle To some extent yes, but if you look at your code I imagine it would be quite obvious where it went wrong. The render function should be rather predictable and simple, especially when it comes to the root. |
I think we’re open to fixing it to be more specific. Would you like to make a PR? |
Where would be a good place to start? |
I would search for that message (or part of it) and look at the conditions that lead to it (I think all in ReactCompositeComponent.js). It might fire in a couple places. We could probably add a It might help to understand the typical cases leading up to this warning so we can lead people in the right direction instead of just showing more info. Thoughts? |
Yeah, I usually run into this when I do things like return the wrong type in an HOC (e.g. a |
@syranide I don't think it's "quite obvious" when receiving this after a larger merge. |
This is a symptom of a larger issue in approach to error messages. e.g.
Ok, so what can they have? Why can't they have refs? Give me a link. |
@kevinslin The problem with commenting in an unrelated issue is that we never know it was a problem (since we don't always check notifications for known issues). It's not a problem in the overall "approach", it's just a particular warning we missed that should have been more actionable. But since it wasn't reported directly, I only read your comment a year later. I'll close this issue because React 16 allows more return types and should give better messages with component stack traces. |
To be clear, it is expected that warnings (which fire earlier) might be more actionable than errors (that fire later). For example, the "cannot have refs" warning includes both component name and stack traces: react/src/renderers/__tests__/ReactStatelessComponent-test.js Lines 163 to 176 in 761decb
|
This is the error message in question:
Not very helpful. Is it technically possible to show what was returned?
The text was updated successfully, but these errors were encountered: