1gotoCoffee = (index) => {
2 this.setState({isLoading:true, select: this.state.coffees[index]})
3 setTimeout(()=>{
4 this.setState({isLoading:false,redirect:true})
5 },5000)
6 }
7
8 render(){
9 const data = this.state.coffees;
10
11 return (
12 <div>
13 <h1 className="title is-1"><font color="#C86428">Menu</font></h1>
14 <hr/><br/>
15 {data.map((c, index) =>
16 <span key={c}>
17 <div>
18 {this.state.isLoading && <Brewing />}
19 {this.renderCoffee()}
20 <div onClick={() => this.gotoCoffee(index)}
21 <strong><font color="#C86428">{c}</font></strong></div>
22 </div>
23 </span>)
24 }
25 </div>
26 );
27 }
28}
29