Home > Mobile >  I am trying to save form data to cloud Firestore
I am trying to save form data to cloud Firestore

Time:11-23

I am trying to save form data to cloud Firestore. Using the following link - enter image description here

The data is not saved to Firestore

CodePudding user response:

Given your imports you are trying to use the new v9 syntax. In that syntax, most features are available as top-level functions, rather than as methods on the Firestore object.

So to get a document from a collection, you'd do:

setDoc(doc(db, 'profileForm', 'contactProfile'), {
   fName: fname.value
})...

Also see the Firebase documentation on writing data to a document.

  • Related