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

Improve error messages for invalid element types #8612

Merged
merged 1 commit into from
Dec 21, 2016

Conversation

sophiebits
Copy link
Collaborator

warning(
false,
'React.createElement: type is invalid -- expected a string (for ' +
'built-in components) or a class/function (for composite ' +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we don't use "composite" in docs much, maybe "user-defined"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"custom components" ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom components makes me think of web components (custom web elements). I think user-defined sounds better 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should “composite components” start becoming part of normal React users lexicon? Even though it may be a bit foreign when a developer first sees and experiences it, it can present an opportunity to start learning about Composite and Host components and how React models things a bit more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keeping what was already there…

'ReactClass (for composite components).'
'Warning: React.createElement: type is invalid -- expected a string ' +
'(for built-in components) or a class/function (for composite ' +
'components) but got: undefined.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be nice to also add the export warning for undefined, since trying to import a named export that doesn't exist will return undefined and I think that's probably a common mistake too. Especially when using third party libraries.

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I agree that undefined should use this addendum as well like @aweary said above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants