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

`ForwardRef(TextField)` is deprecated. Use `minRows` instead , Array = 0 , why ? please help #112

Open ChrisPG2022 opened 2 years ago

ChrisPG2022 commented 2 years ago

please help me, I'm stuck. I wrote the same as Adrian's Repo but I can't solve these two errors. At least one opinion, two I need where to get it, I checked everything and I don't know where the errors come from. Besides all this, I don't understand why it can't find my array? why is it array 0 ?the left side does not load after I created a memory . thank you for your help . BUG 3 BUG 4

MatinT-SA commented 2 years ago

@ChrisPG2022 Hi, dear Chris. Based on what I see in your error messages and in your index.js file in your server directory that you've taken a screenshot from, it seems you haven't implemented what I've already told you yet. (https://github.com/adrianhajdin/project_mern_memories/issues/110#issuecomment-1096856923)

Please comment out this line: mongoose.set('useFindAndModify', false);

Then refresh the page (Ctrl + F5 -> just in case it's going to clear your cache) and then let me know if it fixed your bug or not.

You don't need this peace of code in your index.js file and it will cause error. I think that's the main culprit. It's true that it is the same code in Adrian's repo but it will break the app. So, as I said, commenting out this line can solve your issue.

MatinT-SA commented 2 years ago

@ChrisPG2022 Oh... and by the way, those other things that you've mentioned in the title of your question are warnings. if you read them carefully, you'll figure out how to get rid of them. Or if you didn't understand what to do, you can search for them in Stackoverflow. Warnings don't cause the app to break but errors do.

ChrisPG2022 commented 2 years ago

OK , i comment out this line: mongoose.set('useFindAndModify', false); BUG 6 but my problem was not solved and I got stuck, I tried to create the memory but it doesn't want to be displayed, it shows me that it keeps loading, the array is 0 and I don't understand where I'm wrong? I can't move on if I don't fix this, I also installed @ material-ui / icons as it says but nothing is displayed ...and on top of that, I have no errors in the application

ChrisPG2022 commented 2 years ago

the card is not displayed and ai dont know what I'm doing wrong..

MatinT-SA commented 2 years ago

@ChrisPG2022 Hmm, it's strange. Make sure you've established a connection with your database properly and also make sure that you have created at least one post because if there's no post created yet, then obviously it's not gonna show any post and instead of that will show you the loading icon. Most of the times it can be due to typos and missing a small peace of code or forgetting to close an curly brace or these kind of things. Based on your screenshots, I can't see what's wrong with not showing you the posts' cards (if you have actually created any post). It has to be something with backend. So, check your MongoDb atlas dashboard and see if there's any data in your database and if you are sure you have created at least one post, then try to double check your backend codes.

ChrisPG2022 commented 2 years ago

i stablished a connection with database properly,I checked word for word, comma, curly brace and nothing is missing, I really tried several times to create a post but it doesn't save me, it doesn't appear to me as an array, array is 0 I really don't know why, indeed in the MongoDb atlas dashboard nothing appears data in my database, I feel like dropping it .....I have attached several screenshots to you, maybe you see something that is not good, otherwise I will give up.. A BUG 7 BUG 8 BUG 9 BUG 10 BUG 11 BUG 12 mongo nd once again thank you for your advice and time

MatinT-SA commented 2 years ago

@ChrisPG2022 No problem! Well, when there is no post in your PostMessage model, then it's pretty obvious that it's not gonna show any post to you in the browser and instead of that it's going to display the loading icon. It completely makes sense. The only thing which doesn't make sense to me is the part where you said you are unable to create any post to be saved. Well that's the issue. When you click on the submit button, it has to create the post for you if you have implemented the code correctly. Here are the crucial files which make the difference in this case:

The first one is the posts.js in the actions folder for the frontend The second one is the posts.js file in the controllers for the backend. The third one is the posts.js file in the reducers for the frontend.

Capture Capture1 Capture2

Basically you need to check all the things related to createPost. (So, I highly recommend you to watch the part which is related to createPosts codes in the tutorial one more time carefully.) You can check the output by console.log("any message") in each section to see if that block of code is being executed or not. This will help you to find the main culprit in this issue.

Did you watch the Part 1 & 2 completely or some parts of it? If you can tell me the timestamp of the video you're stuck in and which part it was, maybe I can go back and watch those parts so that I can check where the issue might be and let you know in the next days. (Because I'm watching the part 4 right now and can't remember exactly how the process flow goes for you based on where you've stuck in).

ChrisPG2022 commented 2 years ago

I watched part 1 a lot of times, I wrote exactly as Adrian wrote and still I can't create the memory and my card isn't displayed either. I made a print screen for the 3 posts, reducers, controllers and action to see. I stuck at min 11:18 in Part 2 where my memory should be displayed so I can continue to add, but I can't go on because of this... I really don't know what else to do ERROR json post controllers post reducers posts actions

MatinT-SA commented 2 years ago

@ChrisPG2022 You are receiving 3 errors in the console tab in your browser. Can you tell me what those 3 errors are and show me the exact error message that you're receiving?

ChrisPG2022 commented 2 years ago

after deleting the browser memory, only these two errors appear to me

11111 222222

MatinT-SA commented 2 years ago

@ChrisPG2022 Actually the first one is a warning. So, only the error in your second screen shot is causing the app to break. It's related to your database and connection. Have you selected the "Allow Access from anywhere" option in the network access tab in your MongoDB atlas dashboard? Maybe it's related to you.

ChrisPG2022 commented 2 years ago

yes , i Have selected the "Allow Access from anywhere" option in the network access tab in your MongoDB atlas dashboard and it s not that. Something else break my app.. and i do not Know. Thank You

MatinT-SA commented 2 years ago

So, basically you have two options here in my opinion. The first one is spending more time on your code to finally find out where the issue is and the second one is watching the full tutorial of this project in Adrian's YouTube channel and somehow adapt everything with the packages he had used at the time of recording this project and change whatever is needed. This is actually what I did and I watched his full tutorial one more time from the beginning and it helped me to fix some of the bugs I wasn't able to solve. Of course you don't have to watch every part completely. You can just skim through them quickly. Here is the link of this video: https://www.youtube.com/watch?v=VsUzmlZfYNg&list=WL&index=1&t=22829s