在我的一个项目中,我正在将REACT版本从16.8.6更新到18.2.完成升级后,我在控制台收到的一个主要警告是关于像componentWillReceiveProps
这样的过时的生命周期方法.
REACT给出的警告是Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run
npx REACT-CODEMD RENAME-UNSAFE-LIFECURES in your project source folder.
.
但componentWillReceiveProps
美元对我来说还是有效的.我是不是在升级的时候做错了什么,或者它应该起作用?