【发布时间】:2021-10-25 18:48:05
【问题描述】:
我正在使用 NextJS 和 Typescript 开发一个 Firebase 项目。我正在尝试从 Firestore 数据库中获取数据,但出现此错误 Type 'Promise<QuerySnapshot<DocumentData>>' must have a '[Symbol.iterator]()' method that returns an iterator.
这是我用来从数据库中获取数据的代码
const postsRef = collection(db, "discussions");
query(postsRef, orderBy("createdAt"), limit(20));
const [posts] = getDocs(postsRef)
【问题讨论】:
标签: reactjs firebase google-cloud-firestore next.js