fixed user auth hook bug
This commit is contained in:
parent
49da9e9664
commit
32eb01b9f4
13
src/App.js
13
src/App.js
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import './App.css';
|
||||
|
||||
/*
|
||||
|
@ -12,7 +12,7 @@ import 'firebase/compat/firestore';
|
|||
|
||||
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';
|
||||
|
||||
firebase.initializeApp({
|
||||
|
@ -28,9 +28,11 @@ firebase.initializeApp({
|
|||
const auth = firebase.auth();
|
||||
const firestore =firebase.firestore();
|
||||
|
||||
const [user] = useAuthState(auth);
|
||||
|
||||
|
||||
function App() {
|
||||
const [user] = useAuthState(auth);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
|
@ -51,7 +53,10 @@ function SignIn(){
|
|||
}
|
||||
|
||||
return(
|
||||
<>
|
||||
<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){
|
||||
const {text, uid} = props.message;
|
||||
|
||||
const messageClass = uid;
|
||||
|
||||
return <p>{text}</p>
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user