ed-roh / mern-social-media

Complete React MERN Full Stack Social Media App
992 stars 859 forks source link

Uncaught TypeError: posts.map is not a function at PostsWidget #20

Closed Sagarr124 closed 1 year ago

Sagarr124 commented 1 year ago

I don't understand why am I getting this error although I have written the exact code.

Uncaught TypeError: posts.map is not a function at PostsWidget (PostsWidget.jsx:41:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20074:1) at beginWork (react-dom.development.js:21587:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1) at invokeGuardedCallback (react-dom.development.js:4277:1) at beginWork$1 (react-dom.development.js:27451:1) at performUnitOfWork (react-dom.development.js:26557:1) at workLoopSync (react-dom.development.js:26466:1)

wojkr commented 1 year ago

hey, check urls in postsWidgets.jsx and on the server site. You want to them to match of course.

Sagarr124 commented 1 year ago

Everything same

wojkr commented 1 year ago

seems like youre not receiving data from server. Cant say more without seeing the code

Sama-E commented 1 year ago

I had the same issue then I tried a different browser and it worked. It works on Chrome but I still have some issues in MS Edge.

davidcastagnetoa commented 1 year ago

I have the same problem, console return Uncaught TypeError: posts.map is not a function at PostsWidget (PostsWidget.jsx:41:1) when I write in the explorer http://localhost:3001/users i get Cannot GET /users and "GET /users HTTP/1.1" 404 144", but when I try to access to http://localhost:3001/posts it's return GET /posts HTTP/1.1" 403 13 Access Denied.

Anybody have any idea? thanks

davidcastagnetoa commented 1 year ago

I gotcha, I had to delete the local storage data and the session storage data . I hope its help U @Sama-E @Sagarr124

image

Sama-E commented 1 year ago

Thanks. Definitely helped.

Sagarr124 commented 1 year ago

Thanks. It worked!