https://codesandbox.io/s/5x02vjjlqp
getPlayerssData() {
this.setState({ loading: true });
let comments = [];
fetch("https://jsonplaceholder.typicode.com/comments")
.then(response => response.json())
.then(json => {
comments = json;
// comments = comments.slice(0,3);
this.setState({
loading: false,
comments: comments
});
this.setState({ activeComments: comments.slice(0, 10) });
//console.log(comments);
});
}
render() {
const { comments, loading } = this.state;
// render your progress bar
console.log("render loading--->", loading);
if (loading) return <LoadingBar />;