title: Where do I listen for login status in React Native login view?
body: <p>I've written a login component that works great except I can't figure out the proper way to move to the login page when login is successful. </p>
  
  <p>I know it will somehow involve:</p>
  
  <pre class="lang-js prettyprint-override"><code>if (this.props.user) {
        this.props.navigation.navigate("Main");
        // I'm using react-native-navigation. But any implementation of "now go to the home page" would go here.
      }
  </code></pre>
  
  <p>I've tried putting that at the top of my <code>render</code> method, which works, but I do get an error/warning (error in the debug console, warning in the simulator) saying "Warning: Cannot update during an existing state transition (such as within <code>render</code>). Render methods should be a pure function of props and state."</p>
  
  <p>Makes sense. But I can't conceive of the actual <em>proper</em> place to put it.</p>
  
  <p>PS I tried this but it didn't work at all (navigation doesn't occur)</p>
  
  <pre class="lang-js prettyprint-override"><code>
    shouldComponentUpdate() {
      if (this.props.user) {
        this.props.navigation.navigate("Main");
        return false;
      }
      return true;
    }
  </code></pre>