reactfire icon indicating copy to clipboard operation
reactfire copied to clipboard

How to set new doc in firestore

Open bk973 opened this issue 3 years ago • 2 comments

I want to add data to cloud firestore but I can't find any guides in the documentation

bk973 avatar Sep 05 '22 19:09 bk973

ReactFire is meant to help you consume data from Firestore in React, not provide it. Use the vanilla Firebase JS SDK to make any updates to your database.

aadito123 avatar Sep 07 '22 06:09 aadito123

Thank you so much @aadito123 This helped me

bk973 avatar Sep 08 '22 06:09 bk973

Here's a code snippet from the example app that may help. It shows getting the initialized Firestore SDK with useFirestore and then adds a document in the addAnimal function.

https://github.com/FirebaseExtended/reactfire/blob/363c7c65d2853aa16bbad8b8f13ad81efadf9cea/example/withoutSuspense/Firestore.tsx#L36-L48

jhuleatt avatar Jun 29 '23 14:06 jhuleatt