React中Unsafe生命周期

componentWillMount, componentWillReceiveProps, componentWillUpdate

 不安全: 在未来的React版本中有BUG,特别是允许异步渲染之后

16.3版本

给三个周期添加UNSAFE_*标志。

UNSAFE_componentWillMount, UNSAFE_componentWillReceiveProps, UNSAFE_componentWillUpdate

16.9版本

添加或者不添加前缀UNSAFE_*,都可以使用。但是如果使用不添加前缀UNSAFE_*的话,浏览器会发出警告

17.0版本

移除不添加UNSAFE_*前缀的生命周期,只能使用添加UNSAFE_* 前缀的生命周期。

猜你喜欢

转载自www.cnblogs.com/lyraLee/p/11531112.html