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

Add explicit invariant when ReactDOM is loaded without React #10449

Merged
merged 1 commit into from
Aug 13, 2017

Conversation

aweary
Copy link
Contributor

@aweary aweary commented Aug 12, 2017

Resolves #10406

invariant(
require('react'),
'ReactDOM was loaded without React. Make sure you load ' +
'the React package before loading ReactDOM.',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a big fan of this copy, I'm open to suggestions 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe "ReactDOM was loaded before React."

Copy link
Collaborator

Choose a reason for hiding this comment

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

The other sentence looks good to me.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

Accepted with nits above

var invariant = require('fbjs/lib/invariant');

invariant(
require('react'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's extract this to a variable to be consistent.

invariant(
require('react'),
'ReactDOM was loaded without React. Make sure you load ' +
'the React package before loading ReactDOM.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe "ReactDOM was loaded before React."

invariant(
require('react'),
'ReactDOM was loaded without React. Make sure you load ' +
'the React package before loading ReactDOM.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

The other sentence looks good to me.

@aweary aweary merged commit 5ff5700 into facebook:master Aug 13, 2017
@bvaughn bvaughn mentioned this pull request Sep 7, 2017
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.

3 participants