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

新手做网站用什么软件wordpress电话修改

新手做网站用什么软件,wordpress电话修改,济南 网站建设公司 医疗,建个地方门户网站要多少钱挂载时更新时 setState触发更新、父组件重新渲染时触发更新forceUpdate触发更新卸载时 react#xff08;v17.0.2#xff09;的生命周期图谱如下。 相较于16版本#xff0c;17版本生命周期函数有如下变化#xff1a; componentWillMount() componentWillUpdate() compone…挂载时更新时 setState触发更新、父组件重新渲染时触发更新forceUpdate触发更新卸载时 reactv17.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。 挂载时 组件挂载时会依次调用如下生命周期函数 constructor(props)static getDerivedStateFromProps(props)render()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 Valueundefined除外)。返回的快照值将作为componentDidUpdate的第三个形参。 forceUpdate触发更新 forceUpdate触发更新会依次调用以下生命周期函数 static getDerivedStateFromProps()render()getSnapshotBeforeUpdate()componentDidUpdate() 卸载时 组件卸载时会调用生命周期函数 componentWillUnmount() !DOCTYPE html html langenheadmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titletest/titlescript srchttps://unpkg.com/react17.0.2/umd/react.development.js/scriptscript srchttps://unpkg.com/react-dom17.0.2/umd/react-dom.development.js/scriptscript srchttps://unpkg.com/babel-standalone6/babel.min.js/script /headbodydiv idapp/divscript typetext/babelclass 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:count1})}force () {this.forceUpdate();}render(){console.log(Count---render);const {count} this.state;const {add,death,force} this;return (divh2当前值为{count}/h2button onClick{add}点我加1/buttonnbsp;button onClick{force}强制更新/buttonnbsp;button onClick{death}卸载组件/button/div)}}ReactDOM.render(Count/,document.getElementById(app));/script /body/html
http://www.w-s-a.com/news/953531/

相关文章:

  • 网站优化排名提升百度wap
  • 八里河风景区网站建设内容摘要网站开发基础学习
  • 上海做外贸网站的公司智慧团建网站登陆平台
  • 上海商务网站建设如何做的网站手机可以用吗
  • 产品推广营销方案seo推广员招聘
  • 做水利网站需要多少钱山东市网站建设
  • 做网站找哪里如何修改wordpress颜色
  • 招商加盟网站系统站长工具 seo查询
  • 工商局网站清算组备案怎么做电商培训机构
  • 做好门户网站建设做本地团购网站怎么样
  • wordpress主题和预览不同20条优化防疫措施方案
  • 艾奇视觉网站建设网站推广需要几个人做
  • 2008 iis 添加网站wordpress固定链接标签加上页面
  • 宁波企业网站制作推荐网站优化人员
  • 大型资讯门户网站怎么做排名沈阳建设工程有限公司
  • 开发中英文切换网站如何做江苏网站建设费用
  • 网站论文首页布局技巧桥东网站建设
  • 网站开发项目经理工资北京微信网站
  • 山西山西省建设厅网站微信备份如何转换为wordpress
  • 同城网站开发实用网站模板
  • 郑州做网站哪家公司好国外购买空间的网站有哪些
  • 资讯cms网站有那些餐饮品牌策划设计公司
  • 网站策划选题网站布局优化
  • 网站建设3000字wordpress 微信 主题制作
  • 代做寄生虫网站网站菜单效果
  • 网站备案为什么这么慢目录更新 wordpress
  • 视频在线制作网站Wordpress 外链图片6
  • 网站域名后缀有什么用网站建设的投资预算怎么写
  • 化妆品网站建设网站惠州网站关键字优化
  • 保定网站制作企业下载天眼查企业查询官网