1.事件绑定
render() {
return <div><h1>I'm component4</h1>
{this.state.ArrObj.map(item =><Component5 {...item} key={item.id}></Component5>)}
<button onClick={()=>{this.show()}}>button</button>
</div>
}
show=()=>{
console.log(this.state.ArrObj)
this.setState({
showFlag:true
},function(){
console.log("gogo~")
})
}
2.数据修改
- 修改数据:
这个函数是异步的,第二个参数时成功回调。
this.setState({
showFlag:true
},function(){
console.log("gogo~")
})
- 文本双向绑定