digital-flowers / react-animated-css

React component to show or hide elements with animations
https://digital-flowers.github.io/react-animated-css.html
232 stars 36 forks source link

Warning: componentWillReceiveProps has been renamed, and is not recommended for use ... Please update the following components: Animated #28

Open marcolino opened 4 years ago

marcolino commented 4 years ago

When using react-animated-css@1.2.1 (with react 16.10.2), I get this warning:

backend.js:6 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: Animated

If I drop react-animated-css from my project, the warning disappears.

What do you suggest me to do?

zzzej commented 4 years ago

You are getting the warning because that lifecycle method is gonna be deprecated soon in the React framework. So you can use it for now just take notice of the react's change log before updating. I guess some cool contributor will submit a PR before that happens.

rachit995 commented 4 years ago

I tried solving the issue and created a pull request #30 . I don't know how to test it as a dist lib. Let's see if dev accepts or rectifies solution and merges.