react-firebase-authentication
react-firebase-authentication copied to clipboard
How to access authUser.uid from firebase.js
Hello,
Apologies if this is badly worded or an entirely stupid question. I have followed this fantastic tutorial and it's working perfectly. I would now like to allow logged-in users to post content. This is all fine, but I need to name each user's collection something like .collection(${currentUser.uid}
). What's the best way to access this value in my component, please?
Many thanks for any help.
Matt
Here's a screenshot of of an Android app using Cloud Firestore showing the user collection with unique id's. As you see user collection document id is unique as in phone number or e-mail! Here's how to Get data with Cloud Firestore
Here's a screenshot of of an Android app using Cloud Firestore showing the user collection with unique id's. As you see user collection document id is unique as in phone number or e-mail! Here's how to Get data with Cloud Firestore
Hello Hans, Thank you so much for your reply. I'm sorry I didn't phrase my question correctly. I was wanting to know how, through code, do I access the authUser.uid found in firebase/firebase.js
authUser = { uid: authUser.uid, ... };
I would like to be able to create unique collections in Firestore for each user using their current user id from the Realtime Database. I'm at a loss at the moment. I assume it's either through using the { AuthUserContext } import or the {withFireBase } import but I'm unsure of the actual code. Sincere regards, Matt