I like to do a foreach of multiple Axios responses. I have the following code sitting in the componentDidMount():
var self = this;
axios.get('http://reactlaravel.dev/container/count').then(function (response) {
for (var container in response.data) {
var d = response.data[container];
self.setState({
name: d.name,
total: d.total,
current: d.current
})
}
})
In the second file where I render the class I'd like to show not a single return, but all returns from the loop. How can I make a foreach in this?
return (
<div className="container">
<h1>We hebben nog <strong>{this.props.current}</strong> {this.props.name} zeecontainers over.</h1>
<div className="progress">
<div className={progressBarType} role="progressbar" aria-valuenow={progressBar} aria-valuemin="0" aria-valuemax="100" style={style}>
<span className="sr-only">{progressBar}% Complete (success)</span>
</div>
</div>
</div>
);