问题
- I am new to redux.
- I am using reactredux loading bar package in that I am trying to use loading bar component.
- so I used flag for loading.
- till I get the response I am trying to show loadig bar.
- but I am not successful.
- so in the debugger I put a condole and prints true for loading but after that loading bar is not appearing.
- can you tell me how to fix it so taht in future I will fix it myself.
- providing my codesnippet and sandbox below.
- my code is in RecipeReviewCardList.js
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 />;
来源:https://stackoverflow.com/questions/53903369/using-react-redux-loading-bar-package-in-that-i-am-trying-to-show-loading-bar-co