Skip to content

useAuthState initialising not working #1

@geraldoramos

Description

@geraldoramos

Hi,

I've been trying the useAuthState hook and looks like the initialising variable is not working.

Here is the code:

export default function Login() {

  const { initialising, user } = useAuthState(firebaseAuth());
  const login = () => {
      firebaseAuth().signInWithEmailAndPassword('[email protected]', 'test123');
    };
  const logout = () => { firebaseAuth().signOut(); };
  
    if (initialising) {
      return (
        <div>
          <Spinner marginX="auto" marginY={50} />
        </div>
      )
    }
    if (user) {
      return (
        <div>
          <p>Current User: {user.email}</p>
          <Button onClick={logout}>Log out</Button>
        </div>
      );
    }
    return (
      <Button onClick={login}>Log in</Button>
    )
  }

The login/logout works fine, but I've confirmed that the initialising block is never reached.

Thanks in advance,

Geraldo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions