网站首页 » shouldComponentUpdate

React 组件生命周期

getDefaultPropsobject getDefaultProps()执行过一次后,被创建的类会有缓存,映射的值会存在this.props,前提是这个prop不是父组件指定的 这个方法在对象被创建之前执行,因此不能在方法内调用this.props?,另外,注意任何getDefaultProps()返回的对象在实例中共享,不是复制getIni[...]