Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
firestore.collection no es una función

este es mi firebase.js

 import { initializeApp } from "firebase/app"; import { getFirestore } from "firebase/firestore"; import { getAuth } from "firebase/auth"; import { getAnalytics, logEvent, isSupported } from "firebase/analytics"; // Update the config var firebaseConfig = { // ...Update config }; // Initialize Firebase const app = initializeApp(firebaseConfig); const firestore = getFirestore(app); const auth = getAuth(); const analytics = getAnalytics(app); // Uncomment the following if you want to use emulator // if (process.env.NODE_ENV === "development") { // firestore.useEmulator("localhost", 8080); // auth.useEmulator("http://localhost:9099"); // } export { app, firestore, auth, analytics };

Y así es como lo estoy usando en uno de mis componentes:

 import { app, firestore, auth } from "../../firebase"; const linksPathRef = useMemo( () => firestore.collection("users").doc(userUid).collection("links"), [userUid] );

Pero firestore.collection is not a function . No estoy seguro, dónde me estoy equivocando.

versión de firebase que está instalada en el proyecto "firebase": "^9.6.1"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Como han señalado los comentaristas, está utilizando la sintaxis API anterior mientras importa el SDK v9.

El mensaje es sobre esta línea.

 firestore.collection("users").doc(userUid).collection("links")

En la nueva sintaxis modular, debería ser:

 collection(firestore, "users", userUid, "links")

Recomiendo leer la documentación de Firestore nuevamente y consultar esta guía de actualización .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!