Warning: componentWillReceiveProps has been renamed, and is not recommended for use.
Closed this issue ยท 9 comments
With react 16.9+, componentWillReceiveProps
has been deprecated. Due to the large range of supported react versions with react-placeholder, a fix for this will require a major version change. The current uses could be moved to UNSAFE_componentWillReceiveProps
, but I'm not sure if that is available as far back as react 0.14. Is it time for a version that requires react 16.8+ and is built with hooks? ๐
Any eta when we can expect a new release with the changes?
It would be nice to have it soon.
Soon a new version?
This issue has been pretty quiet, so I'd be happy to take it on! A couple of things come across my mind first:
- I would like to propose dropping support for react <16.8.0 so it can be built using hooks.
- With the high usage of TypeScript in recent years, and added complexity with mixing prop-types and Typescript, I think that prop-types could be removed.
- I think the build tooling could switch to rollup, even using something like tsdx would make this really easy.
To do this upgrade, I would first enhance the test suite for the current version. Then migrate to hooks and function components, and ensure that the tests still pass, or do with minimal changes.
Any thoughts?
@BrianMitchL sounds like a great plan to me!
I completely agree on 1 and 2 (and maybe adding some more tests as a prerequisite)
Not 100% about 3. It doesn't look strictly necessary as of now and/or could be split into a separate effort
Good point, number 3 isn't really related, I'll skip that for this effort ๐ Thanks for the feedback!
I got a really good start on this, but got busy with the holidays, and soon some other obligations. I plan to get back into working on this in another few weeks!
I pushed my work up to https://github.com/BrianMitchL/react-placeholder/tree/hooks if anyone wants to take a look. I tried to make the props stricter and more polymorphic, currently having a few issues with that. The example page seems to work the same when ignoring types. I need to fix that type issue, and would like to write a few more unit tests as well.