渲染
用map方法:
<div className="doing">
<h1>正在进行</h1>
{this.state.Doing.map(item=>{
return(
<div key={item.id}> //每个map后的父div都需要加上key值
<p>{item}</p> //取数据时格式为 {} ,vue是两个{{}}
</div>
)
})}
</div>
声明
若初始化不是class结构则清空代码然后在 rcc
class App extends Component {
constructor(props){
super(props);
this.state={
inpValu:'',
Doing:[],
Done:[]
} //读取调用时应写成 this.state.变量名 的格式,与vue有差异
}
}