FirebaseExtended / reactfire

Hooks, Context Providers, and Components that make it easy to interact with Firebase.
https://firebaseopensource.com/projects/firebaseextended/reactfire/
MIT License
3.51k stars 399 forks source link

How to set new doc in firestore #550

Closed bk973 closed 1 year ago

bk973 commented 1 year ago

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

aadito123 commented 1 year ago

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.

bk973 commented 1 year ago

Thank you so much @aadito123 This helped me

jhuleatt commented 1 year ago

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