简体   繁体   English

我尝试从 firestore 获取一次数据,但我为集合中的每个文档接收三次

[英]I try to get data once from firestore but I recieve it thrice for each document in a collection

在此处输入图像描述

As I have mentioned in the code (in image) I try to get all documents for once but I get it thrice for each document.正如我在代码中提到的(在图像中),我尝试一次获取所有文档,但我为每个文档获取三次。

  const docs = await db.collection("programs").get();
  docs.forEach((doc) => console.log(doc.data()));

I forgot to use componentDidMount in my component where I call this action creator.我忘记在我称之为动作创建者的组件中使用 componentDidMount。 Now I fixed this现在我修复了这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM