我使用React firebase hooks 库有以下代码:
\n // load user state \n const [user, loadingAuthState, errorAuthState] = useAuthState(auth);\n\n // user is loading...\n if(loadingAuthState)\n {\n return <div>\xd7\x98\xd7\x95\xd7\xa2\xd7\x9f...</div>\n }\n // an error has occured\n else if(errorAuthState)\n {\n alert(errorAuthState);\n return <Redirect to="login"/>\n }\n // if the user is not set, return to the login page\n else if(!(user))\n {\n return (<Redirect to="/login"/>)\n }\n\n // load data from the user using the user\'s ID.\n const [value, loading, error] = useDocumentData(doc(db, "users", user.uid));\nRun Code Online (Sandbox Code Playgroud)\n我收到此错误:
\n\n …