我正在嘗試設置 firebase 身份驗證。我有兩個組成部分。第一個是帶有 firebase.auth().currentUser 的應用程序,我正在檢查是否有登錄用戶,然后如果有這樣的用戶,我會呈現頁面,如果沒有,我會呈現登錄頁面。第二個組件我只是從父級獲取處理程序并嘗試呈現登錄頁面?,F在我只看到空白頁和錯誤“'props' 未定義”。請幫我解決它。應用程序.jsimport React, {Component} from "react";import { BrowserRouter as Router, Switch, Route, Link} from "react-router-dom";import { Layout } from 'antd';import AddStock from './components/stocksDB/addStock';import { Typography, Menu } from 'antd';import 'antd/dist/antd.css';import './App.css';import AddClient from './components/clients/addClient.js';import PifForm from './components/clients/pif/pifForm';import KuaForm from './components/clients/pif/kuaForm';import firebase from './firebase.js';import {Login} from './components/login.js'const { Title } = Typography;const {Header, Footer, Content} = Layout;class App extends Component { constructor(props){ super(props); this.state = { login: '', password: '' } } handleChange = (event) => { const target = event.target; const name = target.name; this.setState({ [name]: target.value }, () => {console.log(name, this.state)}) }; signUp = () => { firebase.auth().createUserWithEmailAndPassword(this.state.login, this.state.password).catch(function(error) { console.log(error); }) }; signIn = () => { firebase.auth().signInWithEmailAndPassword(this.state.login, this.state.password).catch(function(error) { console.log(error); }) }; onFinishFailed = errorInfo => { console.log('Failed:', errorInfo); };
無法呈現授權頁面
叮當貓咪
2023-03-03 15:43:49