更新组件

来源:8-1 ⽤useRef实现useDocumentTitle - useRef与Hook 闭包详解(上)

宁静的海8752814

2021-05-21

图片描述
Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code.

  • Move code with side effects to componentDidMount, and set initial state in the constructor.
    Please update the following components: SideEffect(NullComponent)
    按照老师的步骤操作,发现页面有这样一个警告,怎么移除componentDidMount,又怎么样更新SideEffect组件呢?
写回答

1回答

Nolan

2021-05-23

不应该啊..课程里用到的包没有使用到UNSAFE_componentWillMount的,是做了什么以后出现的这个错误?

0
2
宁静的海8752814
我找到解决办法了。 react-helmet软件包已过时,我需要安装“ react-helmet-async”, import { Helmet } from "react-helmet";改为 import { Helmet, HelmetProvider } from "react-helmet-async"; 改为
2021-05-24
共2条回复

React17+Hook+TS4 优质实践,仿 Jira 企业级项目

解锁 React17 高阶用法,轻松应对大型复杂长周期项目

2691 学习 · 1236 问题

查看课程