adrianhajdin / project_mern_memories

This is a code repository for the corresponding video tutorial. Using React, Node.js, Express & MongoDB you'll learn how to build a Full Stack MERN Application - from start to finish. The App is called "Memories" and it is a simple social media app that allows users to post interesting events that happened in their lives.
https://youtube.com/playlist?list=PL6QREj8te1P7VSwhrMf3D3Xt4V6_SRkhu
4.96k stars 1.83k forks source link

THE POSTS DONT RENDER #145

Open Nathan-Eyo opened 1 year ago

Nathan-Eyo commented 1 year ago

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

ghost commented 1 year ago

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 commented 1 year ago

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

ghost commented 1 year ago

Try with configureStore instead of createStore

FALAK097 commented 1 year ago

Try with configureStore instead of createStore

Still doesn't work

ghost commented 1 year ago

Have you set the currentId and setCurrentId

outterspacem commented 1 year ago

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 commented 1 year ago

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

outterspacem commented 1 year ago

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

AAdewunmi commented 6 months ago

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

  2. 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