小编Pas*_*ari的帖子

如何使用 React 在 FireBase 中创建集合

问题很简单。我想创建一个包含集合的文档。另一种措辞方式是我需要在文档中创建一个集合。

我需要能够在 React 中做到这一点。

视觉:集合->文档->集合

这是我需要添加代码的地方:

const addUser = async () => {
    await addDoc(usersCollectionRef, {
      name: newName,
      grade: Number(newGrade),
      role: newRole,
      hours: Number(newHours),

      //Collection Creation should go here as this is where I am making the new document.

    })
  }
Run Code Online (Sandbox Code Playgroud)

注意:这是反应而不是反应本机

javascript firebase google-cloud-firestore

1
推荐指数
1
解决办法
2393
查看次数