https://codesandbox.io/s/kxqppprjv
RecipeReviewCardList.js
getPlayerssData() {
this.setState({ loading: true });
let comments = [];
fetch("https://jsonplaceholder.typicode.com/comments")
.then(response => response.json())
.then(json => {
console.log("store--->", json);
store.dispatch(showLoading("sectionBar"));
comments = json;
// store.dispatch(hideLoading("sectionBar"));
// comments = comments.slice(0,3);
this.setState({
loading: false,
comments: comments
});
this.setState({ activeComments: comments.slice(0, 10) });
//console.log(comments);
});
}
store.js
import { createStore, combineReducers } from "redux";
import { reducer as reduxFormReducer } from "redux-form";
import { loadingBarReducer } from "react-redux-loading-bar";
const reducer = combineReducers({
form: reduxFormReducer, // mounted under "form"
loadingBar: loadingBarReducer
});
console.log("loadingBarReducer reducer--->", reducer);
const store = (window.devToolsExtension
? window.devToolsExtension()(createStore)
: createStore)(reducer);
console.log("loadingBarReducer store--->", store);
export default store;