I've seen a few React polyfill projects pop up recently that experiment with upcoming APIs. It's great to see people excited about the changes we're working on
but I think we should all move carefully to avoid causing any unnecessary fragmentation in the community.
I figured this was the case, and I'm interested in how this works in practice. Would love to see a blog post on how this is achieved. Can you codemod between lifecycle methods or do you write lint rules to find them and then teams get tasked with upgrading them?
-
-
We'll publish a blog post about upgrading the lifecycles soon. It will mention the codemod for renaming lifecycles (e.g. componentWillMount -> UNSAFE_componentWillMount) but will be focused on replacing them manually (e.g. componentWillReceiveProps -> getDerivedStateFromProps).
-
This is because we haven't deprecated the old lifecycles yet. The next React release is intended to give OSS maintainers a chance to upgrade their projects before any deprecation warnings are added. Codemod is a bandaid for large projects that are too big to manually update.
- 1 more reply
New conversation -
-
-
We ran the codemod to use the new UNSAFE lifecycles across the codebase. We also added <StrictMode> that complains if you use UNSAFE ones so you can gradually opt in inside individual products.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.