-
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
Add explicit invariant when ReactDOM is loaded without React #10449
Conversation
invariant( | ||
require('react'), | ||
'ReactDOM was loaded without React. Make sure you load ' + | ||
'the React package before loading ReactDOM.', |
There was a problem hiding this comment.
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 😄
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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.
There was a problem hiding this 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'), |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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.
fb194b5
to
7c2891b
Compare
7c2891b
to
7da3a63
Compare
Resolves #10406