title: Error while cleaning up onAuthStateChanged inside useEffect
body: <p>i return the onAuthStateChanged unsubscribe() function to cleanup the useEffect but it doesnt unsubcribe. what may be causing this bug?</p>
  <pre><code>useEffect(() =&gt; {
          const unsubscribe = onAuthStateChanged(auth, (user) =&gt; {
              if(user){
                  setInterval(()=&gt;{
                      setUser(user)
                      history.push('/home')
  
                  }, 1500)
              }
              else if(!user){
                  setInterval(()=&gt;{
                      history.push('/login')
                      
                  }, 1500)
              }
          })
          return ()=&gt; unsubscribe()
      }, [])
  </code></pre>