export default class App extends Component{
// 状态:
constructor(){
super()//父级构造函数调用
this.state={
title:'zhaoxing',
id:'1'
}
}
// 渲染:
render(){
return (
<div>
<h1>hello {this.state.title}</h1>
<h1>{this.state.id}</h1>
<button onClick={()=>this.setState({id:this.state.id+1})}></button>
</div>
)
}
}
标签:render,title,函数调用,state,使用,组件,id
From: https://www.cnblogs.com/strundent/p/16900529.html