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

279
Views
Firestore getDoc no funcionará al usar pathSegments en reaccionar

Estoy tratando de hacer una carga de datos muy simple desde firebase pero no funcionará cuando uso segmentos de ruta en reaccionar

algo muy simple como

 import { getFirestore, getDoc, getDocs, setDoc, doc, updateDoc, getCollection, collection } from "firebase/firestore"; import { firebaseConfig } from "config"; // Initialize Firebase const app = initializeApp(firebaseConfig); const firestore = getFirestore(app); getDoc(doc(firestore, 'collection', ['path','to','document']));

lanzará una excepción

 Uncaught (in promise) TypeError: n.split is not a function

¿Cómo puedo hacer para pasar una matriz para esa función?

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

0

El doc() no toma una matriz como parámetro sino segmentos de ruta (cadenas). Intente usar la sintaxis de propagación en la matriz como se muestra a continuación:

 getDoc(doc(firestore, 'collection', ...['path','to','document'])); // spread syntax here ⬆ // Equivalent to: getDoc(doc(firestore, 'collection', 'path', 'to', 'document'));

Firma de la función doc() de la documentación:

 export declare function doc(firestore: Firestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
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!