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
¿Cómo puedo mapear a través de este objeto desde firestore?

Obtener la colección de usuarios de firestore:

 useEffect(() => { if (currentUser) { const unsubscribe = db .collection("users") .doc(uid) .onSnapshot((snapshot) => { const arr = []; arr.push({ ...snapshot.data(), }); setUsers(arr); console.log(JSON.stringify(arr)); }); return () => { unsubscribe(); }; } }, [currentUser]);

Esto es lo que se muestra donde console.log(JSON.stringify(arr));

 [ { 1: { others: "books", items: { Item1: true, Item2: true } }, 2: { items: { Item3: true, Item2: true }, others: "books", }, displayName: Inigi, address: "US", }, ];

Soy nuevo en reaccionar, así que esto es bastante confuso para mí. ¿Cómo recupero y visualizo esos 1 y 2 ?

Intenté esto pero no funciona y sigo recibiendo un error:"

TypeError: _user$.items.map no es una función

 {user["1"]?.items.map((index) => ( <li>{index.Item1}</li> ))}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puedes usar {user["1"]?.others}

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!