title: How to pass async data retrieved in splashscreen to App.js?
body: <p><a href="https://whatdidilearn.info/2019/01/13/how-to-implement-a-splash-screen-in-react-native.html" rel="nofollow noreferrer">This article</a> explains how to use splash screen to load data before initial screen. Basically it defines:</p>
  
  <pre><code>const InitialNavigator = createSwitchNavigator({
    Splash: SplashScreen,
    App: AppNavigator
  });
  
  export default createAppContainer(InitialNavigator);
  </code></pre>
  
  <p>Here is the <code>AppNavigator</code>:</p>
  
  <pre><code>const AppNavigator = createBottomTabNavigator(
    {
      Home: {
        screen: HomeNavigator
      },
      HighScores: {
        screen: HighScoresScreen
      },
      {
       initialRouteName: initialScreen,
     } 
    }
  );
  </code></pre>
  
  <p>The <code>initialScreen</code> will be based on the data loaded during initialization. </p>
  
  <p>Here is component <code>SplashScreen</code> which call 2 async functions to load variable <code>result</code> and <code>user</code>:</p>
  
  <pre><code>class SplashScreen extends React.Component {
    performTimeConsumingTask = async() =&gt; {
      var result, user;
      try {
      result = await helper.getJwtToken();
      console.log("App.js token result is : ", result);
      if (result) {
        console.log("App.js result is true. Retrieve user");
        user = await helper._getUser(result.password, result.username); 
        console.log("User is : ", user.name);
  
      } else {
        console.log("App.js result is false");
  
      };
      console.log("I am out of App.js async without error");
    } catch (err) {
      console.log("Error in retrieving token : ", err);
      return "";
  
    };
    }
  
    async componentDidMount() {
      // Preload data from an external API
      // Preload data using AsyncStorage
      const data = await this.performTimeConsumingTask();
  
      if (data !== null) {
        this.props.navigation.navigate('App');
      }
    }
  .......
  </code></pre>
  
  <p>But how can I pass the value of <code>result</code> and <code>user</code> to <code>App</code>?</p>