class ErrorHandle extends Component {
static propTypes = {
infoText: PropTypes.string,
onPress: PropTypes.func,
buttonText: PropTypes.string
};
static defaultProps = {
infoText: '网络出错啦, 请点击按钮重新加载',
buttonText: '重新获取'
};
render() {
return (
{ this.props.infoText }
{ this.props.buttonText }
)
}
}
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
阮一峰 - ECMAScript 6 入门:Class - Class的静态方法
静态属性 通过 类名.成员 的形式访问
static
你要觉得这是js的灾难,你可以加入TC39委员会,然后否决掉这个特性
static是静态,会存储到静态数据区,如果是类中的静态方法,将在在类的第一次加载而加载。并从始至终只会被加载一次。