Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix componentWillUpdate has been renamed warning #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sidhantpanda
Copy link

Moves the extraction of props and eventListeners logic from componentWillUpdate to componentDidUpdate. This fixes the following warning from the console:

Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.

* Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate 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: Lottie

Moves the extraction of props and eventListeners logic from `componentWillUpdate` to `componentDidUpdate`. This fixes the following warning from the console:

```
Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.

* Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate 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: Lottie
```
@elstob
Copy link

elstob commented Sep 20, 2019

@felippenardi - could we have this merged in please? 🙏🏻

if (this.options.animationData !== nextProps.options.animationData) {
this.deRegisterEvents(this.props.eventListeners);
componentDidUpdate(prevProps) {
if (prevProps.options.animationData !== this.props.options.animationData) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is slightly incorrect. It should be this.options here and on line 45 instead of prevProps.options

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you write the if condition here?

randytarampi added a commit to randytarampi/lottie-react-web that referenced this pull request May 26, 2020
Pick up the changes in felippenardi#23
@pinktonio
Copy link

would be nice to have this warning removed 👍

@indigomelody
Copy link

Is it possible to get this merged? Would be awesome to get this error removed

@ioxFR
Copy link

ioxFR commented Sep 16, 2020

@felippenardi there is possible to get any news about the merge of this PR?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants