set dynamic 'initialRouteName' in react-native : <p>question is simple I know there are lots of answers available for the same question but I have differently set my own <code>App.js</code> file i tried almost all but no success.</p>

<p>so my <code>App.js</code> looks like this </p>

<pre><code>import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  StatusBar
} from 'react-native';
import { createStackNavigator  } from 'react-navigation';
import { Header, Button, Spinner } from './src/components/comman';
import SplashScreen from 'react-native-splash-screen';
import LoginForm from './src/components/LoginForm';
import SignupForm from './src/components/SignupForm';
import Home from './src/components/Home';
import ForgetPassword from './src/components/ForgetPassword';


import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
const App = createStackNavigator ({
  Login: { screen: LoginForm },
  Home: { screen: Home },
  Signup: { screen: SignupForm },
  ForgetPassword: { screen : ForgetPassword },
  },
  { 
  initialRouteName: 'Login',
  });

export default App;
</code></pre>

<p>Now I store login state in <code>AsyncStorage</code> in my <code>LoginForm.js</code> like this </p>

<pre><code>.
.
AsyncStorage.setItem('isLoggedIn', 'true').then((a) =&gt; {
    this.onLoginSuccess(responseData.user_id);
});
.
.
</code></pre>

<p>so now i want to set <code>initialRouteName</code> based on my local storage element.
Simple if <code>isLoggedIn</code> is <code>true</code> then <code>initialRouteName : Home</code> otherwise <code>initialRouteName : Login</code></p>

<p>Simple but don't how to use this in <code>my</code> <code>App.js</code> </p>

<p>Please help :)</p>
