Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

react 高版本出现待废弃声明周期的 warnings,componentWillMount、componentWillReceiveProps #127

Closed
lijinpengFj opened this issue Oct 8, 2019 · 1 comment

Comments

@lijinpengFj
Copy link

React 版本: 16.10.2

pro-layout 版本:4.5.16

本地开发环境下,出现 warnings,以下仅为一个示例

Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks 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.

全部 warnings 如图

image

这两个 warnings 为 pro-layout 依赖的 react-document-title、react-conatiner-query 导致,对应的问题的 issue 为 document-titlecontainer-query,建议持续关注

@lijinpengFj lijinpengFj changed the title react 高版本 待废弃声明周期 warnings,componentWillMount、componentWillReceiveProps react 高版本出现待废弃声明周期的 warnings,componentWillMount、componentWillReceiveProps Oct 8, 2019
@afc163
Copy link
Member

afc163 commented Oct 25, 2019

react-document-title 可以换成 react-helmet,来个 PR 吧~

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants