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

Warning message updated if defaultProps were defined as an instance property #9493

Merged
merged 3 commits into from
May 1, 2017
Merged

Warning message updated if defaultProps were defined as an instance property #9493

merged 3 commits into from
May 1, 2017

Conversation

abhaynikam
Copy link
Contributor

@gaearon
Copy link
Collaborator

gaearon commented Apr 26, 2017

Can you change this to say:

Warning: setting defaultProps as an instance property on ComponentName is not supported and will be ignored. Instead, define defaultProps as a static property on ComponentName.

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.

Wording nitpick

@abhaynikam
Copy link
Contributor Author

@gaearon : Thanks for the comment. I have update the warning message. Please have a look

@aweary aweary merged commit 1f5693e into facebook:master May 1, 2017
@@ -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 ' +
Copy link
Collaborator

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.

Copy link
Contributor

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.

Copy link
Collaborator

@gaearon gaearon May 1, 2017

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).

@gaearon gaearon mentioned this pull request May 1, 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.

None yet

4 participants