gpt4 book ai didi

javascript - 警告 : componentWillReceiveProps has been renamed and Please update the following components: Motion

转载 作者:行者123 更新时间:2023-12-02 21:49:26 24 4
gpt4 key购买 nike

我已将react-dom版本迁移到16.9.0+。从那时起我就收到了这个警告。我尝试通过在源文件夹中运行 npx react-codemod rename-unsafe-lifecycles 以及其他一些路径来解决该问题,但一切都是徒劳。这里 this ( https://codesandbox.io/s/github/maddinaprudhvi/animatedMenuIcon ) 沙箱 我试图复制我的警告。

警告我有:

react-dom.development.js:12357 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.
  • 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: Motion

我的问题是:

How can i get rid of this warning?

为什么在将我的react-dom迁移到16.9.0及之后的更高版本后会发生这种情况?

Even after running npx react-codemod rename-unsafe-lifecycles in source folder why this depricated lifecycle is not renamed to UNSAFE_lifecycle-name and why Motion Component is not updating?

预先感谢您的帮助和花费您的时间。

最佳答案

这是 react-motion 的问题 https://github.com/chenglou/react-motion/issues/569 ,但它没有得到积极维护,应该在库前端修复。

If your app runs, it'll be fine. Warnings from react-dom.development.js won't appear in production.

关于javascript - 警告 : componentWillReceiveProps has been renamed and Please update the following components: Motion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60165403/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com