title: Show login screen only if user is not logged in
body: <p>I am trying to make a react native app.
  I have made the login page but I am not able to solve that how can I make a flag that tells me whether I have a user logged in or not.
  If the user is logged in go to dashboard. Else login screen.</p>
  
  <p>This is my App.js.</p>
  
  <pre><code>import React, { useState } from 'react';
  import { StyleSheet, Text, View, Button, AsyncStorage } from 'react-native';
  
  import Login from './components/Login';
  import Dashboard from './components/Dashboard';
  
  export default function App() {
    var [ token, setToken ] = useState('');
  
    function loginHandler(recievedToken) {
      setToken(recievedToken);
    }
    async function _readData() {
      try {
        const value = await AsyncStorage.getItem('Token');
        console.log(value);
        if (value !== null) {
          // We have data!!
          loginHandler(value)
        } else {
          loginHandler(null);
        }
      } catch (error) {
        // Error retrieving data
      }
    };
    return (
      &lt;View&gt;
        &lt;Login /&gt;
      &lt;/View&gt;
    );
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
    },
  });
  </code></pre>