joshwcomeau / react-flip-move

Effortless animation between DOM changes (eg. list reordering) using the FLIP technique.
http://joshwcomeau.github.io/react-flip-move/examples
MIT License
4.08k stars 259 forks source link

Removing UNSAFE_componentWillReceiveProps #252

Closed samgoulden28 closed 3 years ago

samgoulden28 commented 3 years ago

Hey guys,

I am having an issue introducing this library into a codebase I am working on. Mainly because we want to avoid using UNSAFE_componentWillReceiveProps. It is not very future proof and we are receiving console warnings about it.

Is there an update that could be made to potentially use componentDidUpdate instead to achieve the same function? I had a quick go at writing a change yesterday but couldnt get very far.

Is there a real reason for keeping componentWillReceiveProps in the code base?

tobilen commented 3 years ago

I had a quick go at writing a change yesterday but couldnt get very far.

That's the primary reason. Using different lifecycle methods won't work since they happen at the wrong time. You'd need to rewrite the library into hook based functional components, but that would be a huge amount of work. The primary maintainer has marked the project as "no longer being worked on" (see the readme), so i wouldn't expect it to change. I suggest you check out the library linked in the readme (https://github.com/aholachek/react-flip-toolkit) if you need a future-proof solution.