import { useAuthState } from 'react-firebase-hooks/auth';
import { initializeApp } from "firebase/app";
import { getAuth, signInWithPopup, GoogleAuthProvider, signOut } from "firebase/auth";
const firebaseConfig = {
apiKey: "<...>",
authDomain: "<...>",
projectId: "<...>",
storageBucket: "<...>",
messagingSenderId: "<...>",
appId: "<...>"
};
const firebaseApp = initializeApp(firebaseConfig);
const auth = getAuth(firebaseApp)
const provider = new GoogleAuthProvider();
const googleSignIn = async () => await signInWithPopup(auth, provider);
const googleSignOut = () => signOut(auth);
export default function App(){
const [user] = useAuthState(auth);
return user ? <button onClick={googleSignOut}>Logout</button> : <button onClick={googleSignIn}>Sign in with Google</button>
};