9

While upgrading to React 16.9 i am getting the following error. The problem is that i do not have component named: "t". how can i get the real name of it? I don't have unsafe methods on my code so i assume its related to 3rd party lib.

bundle.js:174471 Warning: componentWillReceiveProps has been renamed, and is not recommended for use

  • 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:

  • 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: t

Omtechguy
  • 3,321
  • 7
  • 37
  • 71
  • Do a global search for "componentWillReceiveProps" in the code? – JJJ Sep 12 '19 at 09:40
  • I did... Its not part of my code – Omtechguy Sep 12 '19 at 09:40
  • 1
    Do a global search for "componentWillReceiveProps" in node_modules? – JJJ Sep 12 '19 at 09:42
  • I had a similar problem. I searched in my code but I couldn't find it. At the end of the error message I saw "Please update the following components: Link, Redirect, ...". After upgrading the regarding packages (reat-router-dom in my case) the message was gone. – gfjr Sep 17 '19 at 15:26
  • In my case the message is this: Please update the following components: `GraphiQL`, `QueryHistory` – eQ19 Dec 10 '19 at 23:15
  • There is more information about this situation [here](https://stackoverflow.com/questions/61647771/react-reactstrap-warning-legacy-context-api-has-been-detected-within-a-strict) – Armer B. Nov 19 '20 at 13:02

2 Answers2

3

I experienced the same after upgrading to React 16.9.

It is not easy to track down the root of the warnings (I switched parts of the code on/off until I had the warning isolated).

For me it turned out to be the react-moment library. There's an open issue in that project to resolve the warning: https://github.com/headzoo/react-moment/issues/96

Rob van der Leek
  • 1,486
  • 15
  • 13
-4

Is Deprecated lifecycles warning when using react 16.9.0

React 16.9 Deprecation Will warning

Oleg
  • 3,580
  • 1
  • 7
  • 12