using react redux loading bar package in that I am trying to show loading bar component

放肆的年华 提交于 2019-12-02 18:18:47

问题


  • 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!