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

.Actions must be plain objects. error #14

Open ankita413 opened 3 years ago

ankita413 commented 3 years ago

@adrianhajdin Hey when we are dispatching the action in form.js within the handleSubmit i am getting the following error.Actions must be plain objects. Use custom middleware for async actions. It works if i just dispatch it as dispatch(createPost) but fails if i dispatch it as disPatch(createPost(postData)) Pls tell how can i resolve this

19sajib commented 3 years ago

try this way dispatch(createPost({ postData }) it will work. As you said Actions must be plain objects. So it was expecting an object. Just pass postData as an object using { }

isahilsachdev commented 3 years ago

still not working