Just quick question.
How to do something like this in firebase javascript v9? userDoc is a DocumentSnapshot .
const postRef = userDoc.ref.collection('posts').doc(slug);
I need to access sub-collection with doc snapshot, but I am totally clueless.
You can pass the document reference to the collection function, and the collection ref that gives to the doc function:
const postRef = doc(collection(userDoc.ref, 'posts', slug));
Alternatively, you can skip the collection call here as both collection and doc accept multiple arguments:
const postRef = doc(userDoc.ref, 'posts', slug);