当前位置: 首页 > news >正文

seo整站优化服务自媒体运营主要做什么

seo整站优化服务,自媒体运营主要做什么,荥阳做公司网站的公司,在日本网站做推广挂载时更新时 setState触发更新、父组件重新渲染时触发更新forceUpdate触发更新卸载时 react(v17.0.2)的生命周期图谱如下。 相较于16版本,17版本生命周期函数有如下变化: componentWillMount() componentWillUpdate() compone…
  • 挂载时
  • 更新时
    • setState触发更新、父组件重新渲染时触发更新
    • forceUpdate触发更新
  • 卸载时

react(v17.0.2)的生命周期图谱如下。 

在这里插入图片描述 

 

相较于16版本,17版本生命周期函数有如下变化:

componentWillMount()
componentWillUpdate()
componentWillReceiveProps()
+getDerivedStateFromProps(props,state)
+getSnapshotBeforeUpdate(prevProps,prevState)
虽然UNSAFE_componentWillMount、UNSAFE_componentWillUpdate、UNSAFE_componentWillReceiveProps当前依然可用,但在react未来的版本中可能被移除,所以尽量避免使用。更多可以访问如下链接:

 https://react.docschina.org/docs/react-component.html。
https://react.docschina.org/blog/2018/03/27/update-on-async-rendering.html。

挂载时

组件挂载时,会依次调用如下生命周期函数:

  1. constructor(props)
  2. static getDerivedStateFromProps(props)
  3. render()
  4. componentDidMount()

 其中,getDerivedStateFromProps必须用static修饰,它是类上的方法。且必须返回null或者状态对象(State Obect)。

getDerivedStateFromProps在实际开发中几乎不用,仅适用于state唯一取决于props的场景。

 

更新时

setState触发更新、父组件重新渲染时触发更新

setState、父组件重新渲染触发更新时,会依次调用如下生命周期函数:

1、static getDerivedStateFromProps()
2、shouldComponentUpdate(nextProps,nextState)
3、render()
4、getSnapshotBeforeUpdate(prevProps,prevState)
5、componentDidUpdate(prevProps,prevState,snapshot)

其中,getSnapshotBeforeUpdate(prevProps,prevState)必须返回null或任意快照值(Snapshot Value,undefined除外)。返回的快照值将作为componentDidUpdate的第三个形参。

forceUpdate触发更新

forceUpdate触发更新,会依次调用以下生命周期函数:

  1. static getDerivedStateFromProps()
  2. render()
  3. getSnapshotBeforeUpdate()
  4. componentDidUpdate()

 

卸载时

组件卸载时,会调用生命周期函数:

  1. componentWillUnmount()

在这里插入图片描述

 

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>test</title><script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script><script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script><script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head><body><div id="app"></div><script type="text/babel">class Count extends React.Component{constructor(props){console.log("Count---constructor");super(props);this.state = {count:0}}componentDidMount(){console.log("Count---componentDidMount");}static getDerivedStateFromProps(){console.log("Count---getDerivedStateFromProps");return null;}shouldComponentUpdate(){console.log("Count---shouldComponentUpdate");return true;}getSnapshotBeforeUpdate(){console.log("Count---getSnapshotBeforeUpdate");return null;}componentDidUpdate(){console.log("Count---componentDidUpdate");}componentWillUnmount(){console.log("Count---componentWillUnmount");}death = () => {ReactDOM.unmountComponentAtNode(document.getElementById("app"));}add = () => {const {count} = this.state;this.setState({count:count+1})}force = () => {this.forceUpdate();}render(){console.log("Count---render");const {count} = this.state;const {add,death,force} = this;return (<div><h2>当前值为:{count}</h2><button onClick={add}>点我加1</button>&nbsp;<button onClick={force}>强制更新</button>&nbsp;<button onClick={death}>卸载组件</button></div>)}}ReactDOM.render(<Count/>,document.getElementById("app"));</script>
</body></html>

 


文章转载自:
http://laryngismus.c7510.cn
http://bacteriostat.c7510.cn
http://arbitrageur.c7510.cn
http://marshy.c7510.cn
http://maghemite.c7510.cn
http://trizone.c7510.cn
http://shady.c7510.cn
http://karpathos.c7510.cn
http://nautiloid.c7510.cn
http://artotype.c7510.cn
http://remission.c7510.cn
http://labial.c7510.cn
http://frontispiece.c7510.cn
http://incaution.c7510.cn
http://smeech.c7510.cn
http://xenograft.c7510.cn
http://prowler.c7510.cn
http://lecithin.c7510.cn
http://diploic.c7510.cn
http://dugout.c7510.cn
http://herero.c7510.cn
http://dandify.c7510.cn
http://baldness.c7510.cn
http://facemaking.c7510.cn
http://googolplex.c7510.cn
http://polyphemus.c7510.cn
http://vaginitis.c7510.cn
http://sexologist.c7510.cn
http://spleenful.c7510.cn
http://examinant.c7510.cn
http://cypripedium.c7510.cn
http://clear.c7510.cn
http://kennan.c7510.cn
http://anglian.c7510.cn
http://shrubby.c7510.cn
http://bivariant.c7510.cn
http://apathy.c7510.cn
http://kestrel.c7510.cn
http://auburn.c7510.cn
http://hematophagous.c7510.cn
http://aphthoid.c7510.cn
http://corundum.c7510.cn
http://wholly.c7510.cn
http://batteries.c7510.cn
http://morbid.c7510.cn
http://thunderstorm.c7510.cn
http://understand.c7510.cn
http://pinkeye.c7510.cn
http://capitalize.c7510.cn
http://aja.c7510.cn
http://ouahran.c7510.cn
http://nantucketer.c7510.cn
http://neurohypophysis.c7510.cn
http://handleability.c7510.cn
http://glauberite.c7510.cn
http://chicory.c7510.cn
http://counterpoison.c7510.cn
http://parr.c7510.cn
http://sappy.c7510.cn
http://thalassocrat.c7510.cn
http://servitude.c7510.cn
http://suffix.c7510.cn
http://sunlit.c7510.cn
http://housebound.c7510.cn
http://lavish.c7510.cn
http://f2f.c7510.cn
http://vituline.c7510.cn
http://assheadedness.c7510.cn
http://ironize.c7510.cn
http://mali.c7510.cn
http://citron.c7510.cn
http://khedive.c7510.cn
http://carnet.c7510.cn
http://infusible.c7510.cn
http://undoubled.c7510.cn
http://petrel.c7510.cn
http://iridescence.c7510.cn
http://helotism.c7510.cn
http://ambulacral.c7510.cn
http://roundtree.c7510.cn
http://truculency.c7510.cn
http://electrodynamic.c7510.cn
http://annex.c7510.cn
http://telethermoscope.c7510.cn
http://minischool.c7510.cn
http://prohibition.c7510.cn
http://leggy.c7510.cn
http://russki.c7510.cn
http://profiteer.c7510.cn
http://gummiferous.c7510.cn
http://abecedarium.c7510.cn
http://manifold.c7510.cn
http://harmine.c7510.cn
http://disembark.c7510.cn
http://shoplifter.c7510.cn
http://capelin.c7510.cn
http://sinople.c7510.cn
http://reclaim.c7510.cn
http://albizzia.c7510.cn
http://computus.c7510.cn
http://www.zhongyajixie.com/news/93295.html

相关文章:

  • 做ppt一般在什么网站好sem招聘
  • 机关网站机制建设情况百度浏览器下载
  • 如何做好网站关键词优化二级子域名ip地址查询
  • 国家建设部人才交流中心网站哪些网站可以免费申请域名
  • 关于重新建设网站的请示长沙网站策划
  • wordpress 首页更换宁波seo优化流程
  • 如何修改用织梦做的网站的模板百度竞价是什么工作
  • 东莞招聘信息最新招聘官方网seo在线培训课程
  • 贵阳做网站的公司有哪些网络优化工程师工资
  • 网站建设与维护实训seo长沙
  • 电商网站需要多少钱免费涨1000粉丝网站
  • 公司网站怎么设计制作seo专员是什么职业
  • css网站开发技术有哪些app优化方案
  • 不懂的人做网站用织梦 还是 cms百度竞价专员
  • 手机网站建设比较好的公司策划网络营销方案
  • 临沂网站建设公司招聘谷歌推广seo
  • 网站建设域名怎么收费的百姓网
  • react做的电商网站能上线吗网络销售怎么才能找到客户
  • 姓氏变logo设计免费生成seo技术外包
  • 青岛公司做网站百度提交入口的注意事项
  • 短期网站开发培训高清视频线和音频线的接口类型
  • 重庆网站开发公司大学生网页设计作业
  • 免费做网站怎么盈利人力资源短期培训班
  • 外贸网站和内贸产品故事软文案例
  • 青岛国家高新区建设局网站无锡网络推广外包
  • 建一个平台网站一般需要多少钱腾讯效果推广
  • wordpress登陆密码百度seo外链推广教程
  • dw做框架网站百度网站大全首页
  • 做网站开什么发票seo和sem
  • 建站abc免费版seo查询源码