-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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
Warning message updated if defaultProps were defined as an instance property #9493
Conversation
abhaynikam
commented
Apr 22, 2017
- Updated the warning message as per @gaearon asked for in PR Warning added if defaultProps were defined as an instance property #9433
- Updated the warning message in the testcases as well.
- Issue related to Warn in dev if shouldComponentUpdate is defined on PureComponent #9239
Can you change this to say:
|
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.
Wording nitpick
@gaearon : Thanks for the comment. I have update the warning message. Please have a look |
@@ -504,8 +504,8 @@ describe('ReactCompositeComponent', () => { | |||
|
|||
expectDev(console.error.calls.count()).toBe(1); | |||
expectDev(console.error.calls.argsFor(0)[0]).toBe( | |||
'Warning: defaultProps was defined as an instance property ' + | |||
'on Component. Use a static property to define defaultProps instead.', | |||
'Warning: setting defaultProps as an instance property on Component is not supported ' + |
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.
Not that it matters too much, but for future reference, we start warnings with a capital letter. It should be Setting defaultProps [...]
. We don't consider Warning:
to be part of the sentence.
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.
Thanks for clarifying! Your comment above had it as lowercase so I thought it was fine, but I'll make note of this from now on.
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.
Yea, I only really noticed it in the code.
I thought it's worth changing as it might come up in custom warning dialog (I don't remember if it appends Warning:
or not).