constructor(props){
super(props);
this.state={
list:[],
inputValue:''
}
}
this.setState({
list:[...this.state.list,this.state.inputValue],
inputValue:''
})
设置缓存
localStorage.setItem("key","value");
获取缓存
localStorage.getItem("key")
onClick={this.handleBtnClick.bind(this)}
{
this.state.list.map((item,index)=>{
return <li key={index}>{item}</li>
})
}