title: How can I convert this useEffect firebase onAuthStateChanged function to class?
body: <p>Here is the code I used in the function component</p>
  <pre><code>useEffect(() =&gt; {
      const unsubscribe = firebase.auth().onAuthStateChanged(user =&gt; {
        setIsLoggedIn(!!user);
      });
      return () =&gt; {
        unsubscribe();
      };
    });
  </code></pre>
  <p>Here is my try on the class component.</p>
  <pre><code>componentDidUpdate(
      prevProps: LessonDrawerProps,
      prevState: LessonDrawerState
    ) {
      firebase.auth().onAuthStateChanged(user =&gt; {
            if (user) {
              this.setState({
                isLoggedIn: true,
              });
            }
          });
  }
  </code></pre>
  <p>The class onAuthStateChanged detection is not working properly as in the function component.<br />
  How can this be done?</p>