Tengo el siguiente código de reacción:
export class LoginButton extends React.Component { render() { return ( <img id="logInButton" src="\assets\btn_google_signin_dark_focus_web@2x.png" onClick={() => { signIn() }}></img > ); }} ReactDOM.render(<LoginButton />, document.getElementById('logInRoot'));Y código HTML:
<body> <div id="logInRoot"></div> </body> Cuando se llama a la función signIn() , aparece la IU de inicio de sesión de Google de Firebase y el usuario inicia sesión.
Lo que debo hacer es hacer que desaparezca el div con id "logInRoot". Luego vuelve a aparecer si el usuario cierra sesión nuevamente.
Aquí está mi código para signIn() :
export const auth = getAuth(); export function signIn() { signInWithPopup(auth, provider) .then((result) => { // This gives you a Google Access Token. You can use it to access the Google API. const credential = GoogleAuthProvider.credentialFromResult(result); const token = credential.accessToken; // The signed-in user info. const user = result.user; // ... }).catch((error) => { // Handle Errors here. const errorCode = error.code; const errorMessage = error.message; // The email of the user's account used. const email = error.email; // The AuthCredential type that was used. const credential = GoogleAuthProvider.credentialFromError(error); // ... }); }¿Puede alguien decirme cómo hago para hacer esto?