我得到了这个简单的表单,用于注册用户并将 uid 和电子邮件数据发送到 firestore 上的集合,我使用最新版本的 Firebase 9 w/ 模块化。身份验证工作得很好,但 firestore 部分却不行。它向我抛出一个错误:
TypeError: Cannot read properties of undefined (reading 'indexOf')
at Function.fromString (path.ts:229)
at Ac2 (reference.ts:374)
at Login.jsx:29
Run Code Online (Sandbox Code Playgroud)
我不知道这是什么意思,我试图按照“用户/(这里是 useruid)/所有用户数据”的顺序将注册用户的电子邮件和 uid 信息上传到 firestore,但会抛出该错误。
我留下我的代码:
import React, { useState, useEffect, useCallback } from 'react'
import { auth, db } from "../firebase"
import { createUserWithEmailAndPassword } from "firebase/auth";
import { collection, doc, addDoc, setDoc } from "firebase/firestore";
function Login() {
const [email, setEmail] = useState('')
const [pass, setPass] = useState('')
const [error, setError] …
Run Code Online (Sandbox Code Playgroud)