export default class Home extends Component { static defaultProps = { url_api: 'https://www.baidu.com' } constructor(props){ super(props); this.state = { isRefreshing: false }; }
}
取值的方法和es5一样
本文介绍了一个React类组件的示例代码,演示了如何设置默认属性和构造函数初始化状态的方法。此外,还提到了类组件中设置API请求URL的方式。
export default class Home extends Component { static defaultProps = { url_api: 'https://www.baidu.com' } constructor(props){ super(props); this.state = { isRefreshing: false }; }
}
取值的方法和es5一样

被折叠的 条评论
为什么被折叠?