阿里 Ant design

Ant Design 组件按需加载

参考资料:https://blog.csdn.net/well2049/article/details/78801228

 react生命周期

 组件优化:

  props

  this.state={
     n:0
  }

   this.setState({

      n:100

})

生命周期钩子:

一、初始化阶段
1.设置默认属性: defaultProps

   //设置默认属性
static defaultProps={
    num:100
}

2.构造器

     constructor() {
           super();
           //初始状态
           this.state={
               comments:[],
               flag:true,
               value:3,
               n:1

           }

        }

3.组件加载之前:componentWillMount

4.render:渲染

5.componentDidMount:可以进行DOM相关的操作和获取后台数据(即ajax)

二、运行阶段

1.componentWillReceiveProps() 组件接收到属性时触发

2、shouldComponentUpdate()  主要用于优化组件

>  当组件接收到新属性,或者组件的状态发生改变时触发。组件首次渲染时并不会触发
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Ant Design 组件按需加载 参考资料:https://blog.csdn.net/well2049/art...
    他方l阅读 1,120评论 0 0
  • Ant Design 组件按需加载 参考资料:https://blog.csdn.net/well2049/art...
    Yaoxue9阅读 653评论 0 0
  • 学习笔记 原文地址:antDesignPro使用心得,快速开发必备。https://www.52pojie.cn/...
    kalshen阅读 44,730评论 8 85
  • 4. I'll tell her when she comes back. 她一回来我就告诉她。 本句是由when...
    小绿植物阅读 922评论 0 0
  • 细说指针 指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址。要搞清一个指针需要搞清指针的四方面的内...
    YuWenHaiBo阅读 255评论 0 0