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.
Wow. Sorry! Looks like I fucked up there.
There was a problem hiding this comment.
Haha no worries. Fresh eyes always help 👀
|
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-classfactory aware of the new "UNSAFE_" lifecycle names so that:UNSAFE_componentWillRecieveProps.I've built
addons/create-react-classlocally 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.