Im trying so sav data on firestore through react native but when I press the buttom to save data, I get "Possible unhandled promise rejection (id:1); I dont know what else to do. Thanks. There my code below.
My code in App.js
async function submit() {
await db.collection("cities").add({
name: "Tokyo",
country: "Japan",
});
}
My Firebase code
import { initializeApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";
const firebaseConfig = {
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
authDomain: "xxxxxxxxxxxxxxxxxxxx",
projectId: "xxxxxxxxxxxxxxxxxxxxxxxxxx",
storageBucket: "xxxxxxxxxxxxxxxxxxxxxxxx",
messagingSenderId: "xxxxxxxxxxxxxxx",
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
export default db;