fixed user auth hook bug

This commit is contained in:
Digi 2024-11-19 08:55:00 +01:00
parent 49da9e9664
commit 32eb01b9f4

View File

@ -1,4 +1,4 @@
import React from 'react'; import React, { useRef, useState } from 'react';
import './App.css'; import './App.css';
/* /*
@ -12,7 +12,7 @@ import 'firebase/compat/firestore';
import 'firebase/compat/auth'; import 'firebase/compat/auth';
import {useAuthState, useSignInWithGoogle} from 'react-firebase-hooks/auth'; import {useAuthState} from 'react-firebase-hooks/auth';
import {useCollectionData} from 'react-firebase-hooks/firestore'; import {useCollectionData} from 'react-firebase-hooks/firestore';
firebase.initializeApp({ firebase.initializeApp({
@ -28,9 +28,11 @@ firebase.initializeApp({
const auth = firebase.auth(); const auth = firebase.auth();
const firestore =firebase.firestore(); const firestore =firebase.firestore();
const [user] = useAuthState(auth);
function App() { function App() {
const [user] = useAuthState(auth);
return ( return (
<div className="App"> <div className="App">
<header className="App-header"> <header className="App-header">
@ -51,7 +53,10 @@ function SignIn(){
} }
return( return(
<>
<button onClick={signInWithGoogle}>Sign in with google</button> <button onClick={signInWithGoogle}>Sign in with google</button>
<p>Do not violate the community guidelines or you will be banned for life!</p>
</>
) )
} }
@ -80,6 +85,8 @@ function ChatRoom(){
function ChatMessage(props){ function ChatMessage(props){
const {text, uid} = props.message; const {text, uid} = props.message;
const messageClass = uid;
return <p>{text}</p> return <p>{text}</p>
} }