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

94
Views
No se pueden obtener los datos de la base de datos de Firebase para reaccionar de forma nativa

Estoy aprendiendo reaccionar nativo, y ahora estoy usando firebase...

Pero no puedo obtener datos de la base de datos de firebase tan fácilmente como java, me pregunto si estoy haciendo algo mal en alguna parte, alguien que me ayude, ¡gracias!

No puede llevar los datos a setCarts...

¡Aquí está mi código y la base de datos de firebase!

 const getCartProducts = () => { database() .ref("carts/" + user.uid + "/") .on("value", function (snapshot) { let array = []; snapshot.forEach(function (childSnapshot) { let childData = childSnapshot.val(); let k = childSnapshot.key; database() .ref("products/" + k) .on("value", function (s) { let sData = s.val(); array.push({ id: k, count: childData.count, imageUrl: sData.imageUrl, name: sData.name, type: sData.type, price: sData.price, like: sData.like, popular: sData.popular, storageQuantity: sData.storageQuantity, description: sData.description, }); }); }); // console.log(array); setCarts(array); }); };

imagen de base de datos firebase

about 4 years ago · Juan Pablo Isaza
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!