question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

componentWillReceiveProps is going to be deprecated

See original GitHub issue

React is going to deprecate componentWillReceiveProps in version 17 which will affect AnimatedSwitch.

Do you have any plan to fix it?

I am not sure if you move the affected code into “componentDidUpdate” will cause any other trouble. There is another way “getDerivedStateFromProps” but that will force people to have react 16.3.0+ as peer dependency.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
maisanocommented, Oct 22, 2019

This has been solved by #110 – let me know if you have any other concerns.

1reaction
harleylangcommented, Aug 23, 2020

@maisano I am receiving a similar message:

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: TransitionMotion
Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - why is componentWillReceiveProps deprecated?
Thus, componentWillReceiveProps is being deprecated in favor of the following reason: Use getDerivedStateFromProps. Or, use componentDidUpdate.
Read more >
React17, or how to get rid of “componentWillReceiveProps”?
As you may already know, with the release of React 16.3, some of legacy lifecycles were deprecated. One of the biggest lessons we've...
Read more >
Refactor componentWillReceiveProps() to ... - Egghead.io
The componentWillReceiveProps() method is being deprecated in future version of React (17). Many of us use this method day-to-day to check for incoming...
Read more >
Replacing 'componentWillReceiveProps' with ... - Medium
With the release of React 16.3, some new lifecycle methods have been introduced, and release of React 17 will deprecate some lifecycle method....
Read more >
React: componentWillMount to be deprecated! - Northcoders
getDerivedStateFromProps is going to handle what componentWillReceiveProps and componentDidUpdate did. After either a component is created or when it receives a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found