0

I am new to React Native and Firebase so please bear with me. I have a Collection named "CategoryCollection" and I want the user to add documents inside the collection. As the user adds the document, I want to create a sub category named "TaskCollection" automatically. Is there a way to do it?

const docRef = await db.collection('CategoryCollection').add(newItem).doc(newItem.category).collection('TaskCollection').add({task: '',duedate: '',isDone: false,});

I have tried it this way, but there is an undefined error.

Any help would be appreciated!

0 Answers0