title: What do I unmount in componentDidMount
body: <p>In a page wrapping <code>component</code> I am setting <code>state</code> in <code>componentDidMount</code> to handle <code>logging</code> authentication as</p>
  
  <pre><code>componentDidMount() {
    if (typeof window !== 'undefined') {
      firebase.auth.onAuthStateChanged(authUser =&gt; {
        authUser
          ? this.setState(() =&gt; ({ authUser }))
          : this.setState(() =&gt; ({ authUser: null }));
      });
    }
  }
  </code></pre>
  
  <p>However, on some page renders I receive this error.</p>
  
  <pre><code>Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
  </code></pre>
  
  <p>Obviously, <code>componentWillUnmount</code> is what I need to use to unmount the component but what am I to unmount, the <code>setState</code> or <code>firebase.auth.onAuthStateChanged</code>?</p>