Back

Technologies:

javascriptjavascript
reactjsreactjs
avatar
Tolerim
21 hours ago

All posts are being mapped with user details currently.

The user's name and email are being associated with all posts, despite each post being unique to a particular user. The firebase 9 authentication method for storing users' names and emails does not appear to be working for a beginner like me. In addition, I have written login and feed components that use features such as creating a post, uploading images and videos. The code for these components is provided as well.
Answers(1)
avatar
Tolerim
21 hours ago
Verified Answer
It seems like the current user details are getting mapped to all the posts, but each post should be created by a unique user. The displayed posts are all showing the current user name and email, but the goal is to store each user's name and email in Firebase Authentication. The provided code includes a login page and a feed page that retrieves and displays posts from a Firebase collection. Without more specific information about the issue, it's hard to determine exactly what is causing the problem or how to fix it. However, there are a few things that could be causing the issue. One possible cause could be related to how the displayName and email properties are being set in the Firebase Authentication user profile. The provided code includes the following line in the Register function:
updateProfile(user, {
  displayName: Name,
  email: Email,
});
This should set the user's displayName and email properties in Firebase Authentication. However, it's unclear where the Name and Email values are coming from or whether they are being set correctly. If these values are not set correctly, it could cause issues with displaying the correct user details in the feed. Another issue could be related to how the posts are being displayed in the feed. The code currently retrieves all posts from the Firebase collection and maps over them to display each one. However, it's not clear whether the userName and Learningreact properties in the Firebase collection correspond to the correct user for each post. If these properties are not set correctly, it could cause issues with displaying the correct user details in the post. Without more information and code to work with, it's difficult to provide a more specific answer. If you can provide more details about the issue and the code that is causing the problem, I can try to provide more guidance.
;