onclick react history map

Solutions on MaxInterview for onclick react history map by the best coders in the world

showing results for - "onclick react history map"
Amina
16 Jul 2020
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