美文网首页
组建中的生命周期

组建中的生命周期

作者: 夜未殇 | 来源:发表于2017-01-06 15:28 被阅读0次
//创建属性
constructor(props) {
    super(props);
    console.log("ChildView+constructor")
}

//组建将要加载
componentWillMount() {
    console.log("ChildView+componentWillMount")
}

//渲染开始
render() {
    console.log("ChildView+render")
    return(
        <h3>{this.props.content}</h3>    )
}

//组建加载完成
componentDidMount() {
    console.log("ChildView+componentDidMount")
}

//默认值return true ,只有return true时,UI才能被重新渲染(即重新调用render)
shouldComponentUpdate(nextProps,nestState) {
    console.log("ChildView+shouldComponentUpdate");
    return true;
}

//组建将要刷新
componentWillUpdate(nextProps,nestState) {
    console.log("ChildView+componentWillUpdate");
}

//组建完成刷新
componentDidUpdate(nextProps,nextState) {
    console.log("ChildView+componentDidUpdate");
}

//组件将要接收到新的属性值
componentWillReceiveProps(nextProps) {
    console.log("ChildView+componentWillReceiveProps");
}

//组建将要销毁
componentWillUnmount() {
    console.log("ChildView+componentWillUnmount");
}

相关文章

  • 组建中的生命周期

  • Activity生命周期分析

    Activity生命周期分析 标准情况下 onCreate():表示Activity正在创建中,初始化工作,比如调...

  • maven-idea工具maven生命周期

    idea工具maven projects里面有9种生命周期。生命周期是包含在一个项目构建中的一系列有序的阶段。ma...

  • 不一样的Activity生命周期

    生命周期分三组: 1.完整的生命周期: 2.可视的生命周期: 3.前台的(可交互的)生命周期: 单个Activit...

  • Gradle -构建生命周期

    一、Gradle构建生命周期的三个阶段 1.初始化根据settings.gradle,决定哪些项目要参与到构建中来...

  • mavan开发要点总结(三)

    五、maven生命周期与插件机制 maven生命周期maven共有三套生命周期,每套生命周期又由若干个phase组...

  • angular6.x--生命周期

    按照生命周期执行的先后顺序,Angular生命周期接口如下所示 生命周期顺序简写在Angular通过构造函数创建组...

  • [Vue]生命周期

    什么是Vue的生命周期 每种事物从诞生到消亡,都有自己的生命周期。而我们这里的Vue 的生命周期指的是 Vue 组...

  • Android Lifecycle源码解析

    一.Lifecycle是什么?  Lifecycle是生命周期的意思。它是Jetpack中的一个 生命周期感知型组...

  • 进阶react.js

    组件生命周期 组件的生命周期有助于理解组件的运行方式,完成更复杂的组件功能、分析组件错误原因等组件的生命周期: 组...

网友评论

      本文标题:组建中的生命周期

      本文链接:https://www.haomeiwen.com/subject/iutxbttx.html