-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
RFC 6: createReactClass updates #12036
Conversation
CI failure is unexpected, given the limited scope of these changes. Edit: Looks like the last commit to this branch (4c75c5b) also failed CI for this same reason, so I'm going to ignore it. |
I don't think I actually need to care about the failing CI. The changes to the bundled |
What about the static one |
Statics can't be defined on the object passed to the I've added tests for the combination of these two with 286df77 FWIW. |
createClass({
statics: {
getDerivedStateFromProps() {
}
}
}) This approach also works with mixins. |
Oh cool. I had no idea. 😄 Declaring the static method should work without any changes, although I've added a test for it (68f2fe7). Mixing it in wouldn't, but I think that's reasonable since...what would it mean to mix two of those methods? What would the return value be? |
This should be ready for review 😄 I'm happy to publish to NPM once it's merged. I've done a dry-run locally and verified that all of the tests for this addon pass and no unexpected changes are in the build. |
Should work the same way as |
Eh, yuck. 😄 Okay. |
I've added support for |
addons/create-react-class/factory.js
Outdated
* | ||
* @optional | ||
*/ | ||
UNSAFE_shouldComponentUpdate: 'DEFINE_MANY', |
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.
This is new to me. Why?
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.
Wow. Sorry! Looks like I fucked up there.
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.
Haha no worries. Fresh eyes always help 👀
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.
This makes sense to me
Thanks! Releasing this should be pretty simple. (Just run I'll wait and release it just before the 16.3 release though, so as to avoid confusion. |
This codemod corresponds with reactjs/rfcs/pull/6 and /pull/12028
Make
create-react-class
factory aware of the new "UNSAFE_" lifecycle names so that:UNSAFE_componentWillRecieveProps
.I've built
addons/create-react-class
locally and compared it to the 15.6.2 release in NPM to verify that the only changes between the two are the additions I've made with this PR. This should make the release very low risk.