onclick react history map
gotoCoffee = (index) => {
this.setState({isLoading:true, select: this.state.coffees[index]})
setTimeout(()=>{
this.setState({isLoading:false,redirect:true})
},5000)
}
render(){
const data = this.state.coffees;
return (
<div>
<h1 className="title is-1"><font color="#C86428">Menu</font></h1>
<hr/><br/>
{data.map((c, index) =>
<span key={c}>
<div>
{this.state.isLoading && <Brewing />}
{this.renderCoffee()}
<div onClick={() => this.gotoCoffee(index)}
<strong><font color="#C86428">{c}</font></strong></div>
</div>
</span>)
}
</div>
);
}
}
Also in JavaScript:
- file-loader support json file
- getusermedia example
- Javascript format to currency
- how to format an integer with a comma in javascript
- doughnut chart.js chart go away when no values
- compare two arrays javascript
- for function js
- javascript create range with a loop
- get length of array
- delete node module
- jquery get current row value
- javascript format date time
- chat application in react js
- background image with styled components
- map function javascript
- cpf validador javascript
- js get current seconds
- datatable set row id
- how to hide javascript element by class
- localstorage javascript
- jsonobjectrequest
- create callback function javascript
- Javascript validate password
- object json parse javascript