Skip to content

Make warning about state assignment better in ReactFiberClassComponent #11830

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed

Conversation

yenshih
Copy link
Contributor

@yenshih yenshih commented Dec 11, 2017

Hi, I have extracted some common code about warning in ReactFiberClassComponent.
It seems the warning about state assignment in componentWillMount and componentWillReceiveProps can use a same function, which avoid hard coding the warning log twice.

@gaearon
Copy link
Collaborator

gaearon commented Dec 11, 2017

Thanks for the PR! I don't think we'll take this, as we generally don't mind some light duplication, and in this case extracting doesn't make it much clearer.

However I just noticed the first warning doesn't seem to be deduplicated. Could you send a PR that fixes that instead?

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

Successfully merging this pull request may close these issues.

3 participants