Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THE POSTS DONT RENDER #145

Open
Nathan-Eyo opened this issue Oct 23, 2022 · 9 comments
Open

THE POSTS DONT RENDER #145

Nathan-Eyo opened this issue Oct 23, 2022 · 9 comments

Comments

@Nathan-Eyo
Copy link

The posts refuse to show up even though they are present in the database and the API.

@ghost
Copy link

ghost commented Nov 27, 2022

If you are using configureStore instead of createStore because it says in VSCode that createStore is deprecated then probable that is the error. Atleast it was for me. Simply just ignore what VSCode says about createStore and just use it. I hope that helps

@FALAK097
Copy link

errorPostnotShowing
Post is present in the database but doesn't show up on the screen.

@ghost
Copy link

ghost commented Dec 21, 2022

Try with configureStore instead of createStore

@FALAK097
Copy link

Try with configureStore instead of createStore

Still doesn't work

@ghost
Copy link

ghost commented Dec 22, 2022

Have you set the currentId and setCurrentId

@outterspacem
Copy link

Hi @ProHaies. I am almost encountering the same issue - my posts are displayed fine at the time of creation and they even get created in my MongoDB cluster but I don't see anything in my browser console + I get the circular progress spinner when I reload the page (the posts don't get fetched). Any ideas on what the issue might be?

@ghost
Copy link

ghost commented Dec 29, 2022

Hi @outterspacem check the currentId if it's placed properly like in the video otherwise I have no idea

@outterspacem
Copy link

outterspacem commented Dec 29, 2022

@ProHaies update: I solved the issue by making sure useEffect(() is under const dispatch = useDispatch();

@AAdewunmi
Copy link

The posts refuse to show up even though they are present in the database and the API.

Issue fixed!
If you are having issues with Redux createStore() being depreciated, here's how to use configureStore():

  1. Run on server side console ->

NPM

npm install @reduxjs/toolkit

Yarn

yarn add @reduxjs/toolkit

  1. Include configureStore() in your client/src/index.js file
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
// import { createStore, applyMiddleware, compose} from "redux";
// import thunk from "redux-thunk";
import { configureStore } from "@reduxjs/toolkit";
import reducers from "./reducers";
import App from "./App";
import "./index.css";

// const store = createStore(reducers, compose(applyMiddleware(thunk)));
const store = configureStore({ reducer: reducers });
ReactDOM.render(
    <Provider store={store}>
       <App />
    </Provider>,
  document.getElementById("root")
);

Job done!

Screenshot 2023-12-25 at 10 11 16

Screenshot 2023-12-25 at 10 11 43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants