-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Component attempting to render unexpected value renders <undefined></undefined> #671
Comments
Just tested out of curiosity, and React seems to throw an error in such situations. |
Ah yep, this makes sense. In 7 or 8 (don't remember), we moved type handling into Seems like the solution is just to extend this condition a bit: Something like: if (vnode==null || vnode===false || vnode===true) vnode = '';
if (typeof vnode==='string' || typeof vnode==='number') {
// ... |
So the idea would be to avoid throwing an error by silently ignoring booleans + implicitly converting numbers, right? Doesn't seem that difficult. I'll try to send a PR. |
Components attempting to render something that is neither a component, or a
null
/undefined
value, results in an<undefined></undefined>
node rendered to the DOM.e.g. :
const Zero = () => (0)
=> renders<undefined></undefined>
const Number = () => (42)
=> renders<undefined></undefined>
const False = () => (false)
=> renders<undefined></undefined>
Here is a test case to reproduce.
Not sure how it is supposed to behave, but rendering
<undefined></undefined>
does feel appropriate to me and might lead to unexpected behaviors.The text was updated successfully, but these errors were encountered: