我不知道为什么,但是当我运行我的 React 应用程序时,我看到了以下警告:
react-dom.development.js:12357 Warning: componentWillMount has been renamed, and is not recommended for use. See *documentation* for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount 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: SideEffect(NullComponent)
我很困惑,因为我没有使用这种生命周期方法。相反,我在我的代码中使用了 useEffect、useMemo 和 useState 挂钩。我希望我有办法摆脱这个警告。