question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

initialising and error not working on Auth Hook

See original GitHub issue

Just tried the example you provided

import { useAuthState } from 'react-firebase-hooks/auth';

const CurrentUser = () => {
  const [user, initialising, error] = useAuthState(firebase.auth());
  const login = () => {
    firebase.auth().signInWithEmailAndPassword('test@test.com', 'password');
  };
  const logout = () => {
    firebase.auth().signOut();
  };

  if (initialising) {
    return (
      <div>
        <p>Initialising User...</p>
      </div>
    );
  }
  if (error) {
    return (
      <div>
        <p>Error: {error}</p>
      </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>;
};

Same result. Uncaught error. Using v2.1.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
deebovcommented, Nov 15, 2019

i am having the same issue. the initialising and error variables does not re-render the component when they are changed

1reaction
pgonzalez-santiagocommented, Jan 27, 2020

Same here. What is happening?

Read more comments on GitHub >

github_iconTop Results From Across the Web

loading and error not working on Auth Hook · Issue #85 - GitHub
You can solve the problem by using catch() in your signInWithEmailAndPassword method, plus the error which the hook provides is just when your ......
Read more >
Why react firebase hook do not working to show error in sign ...
I tried several times to display error.message but do not showing anything and in console error is showing false when I made any...
Read more >
How to Set Up GitHub User Authentication using Firebase and ...
In this tutorial, I will walk you through the process of creating a GitHub User Authentication System using Firebase and React (with hooks)....
Read more >
Auth0 React SDK Quickstarts: Login
Auth0 allows you to add authentication to your React application quickly and to gain access to user profile information. This guide demonstrates how...
Read more >
5 Most Common useState Mistakes React Developers Often ...
Initiating the useState hook incorrectly is one of the most common mistakes developers make when utilizing it. What does it mean to initialize ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found