【发布时间】:2022-06-15 05:20:23
【问题描述】:
任何人都可以帮助我了解 React Hooks 基础知识,我比较新,无法在线找到适当的帮助
import React from 'react'
import { auth, provider } from "../../../firebaseSetup";
import { useNavigate } from "react-router-dom"
const GoogleAuth = async() => {
const navigate = useNavigate()
auth.signInWithPopup(provider).then(() => {
navigate('/home');
}).catch((error) => {
console.log(error.message)
})
}
export default GoogleAuth
我在const navigate = useNavigate() 上收到错误消息:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component
【问题讨论】:
标签: javascript reactjs