componentWillReceiveProps has been renamed

Hi guys. I’m getting this console message. Maybe you’re already aware of this recent change. Thanks

backend.js:6 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See 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:
  • 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.

Hi Marcos, actually RS is not utilizing componentWillReceiveProps for anything at the moment. For me it looks like the warning is coming from backend.js package. Would you be able to try to increase the backend.js package version number in case they have already done the necessary changes to solve the issue?

Hi Juha. Makes sense. I’ll check, thank you

Hi Juha. I was trying to understand Antti’s exemple and I found the “componentWillReceiveProps”

Yes, we need to get rid of it at some point. We aren’t using it for anything anymore so it shouldn’t cause problems.

1 Like