title: Trying to display the registered name in my home screen
body: <p>Hi so I have an application where the person registers himself and gets taken to the home screen where I have a flatlist of everyone who has registered. I want to make it so that it can display the users name who has signed in on the home screen like Welcome {user}. I am still a beginner so any help would be useful. Here is my code:-</p>
  <p>Sign Up Screen:-</p>
  <pre><code>function SignupScreen(props) {
    const [email, setEmail] = useState('');
    const [password, setPassword] = useState('');
    const [name, setName] = useState('');
  
    const sendCred = async (props) =&gt; {
      fetch('http://10.0.0.2/signup', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          email: email,
          password: password,
          name: name,
        }),
      })
        .then((res) =&gt; res.json())
        .then(async (data) =&gt; {
          try {
            await AsyncStorage.setItem('token', data.token);
            props.navigation.navigate('Home');
          } catch (e) {
            console.log('error', e);
          }
        });
    }; 
    return (
          &lt;TextInput
            label=&quot;Email&quot;
            mode=&quot;outlined&quot;
            value={email}
            style={{ marginLeft: 18, marginRight: 18, marginTop: 18 }}
            theme={{ colors: { primary: 'blue' } }}
            onChangeText={(text) =&gt; setEmail(text)}
          /&gt;
          &lt;TextInput
            label=&quot;password&quot;
            mode=&quot;outlined&quot;
            secureTextEntry={true}
            value={password}
            onChangeText={(text) =&gt; {
              setPassword(text);
            }}
            style={{ marginLeft: 18, marginRight: 18, marginTop: 18 }}
            theme={{ colors: { primary: 'blue' } }}
          /&gt;
          &lt;TextInput
            label=&quot;Name&quot;
            value={name}
            mode=&quot;outlined&quot;
            onChangeText={(text) =&gt; setName(text)}
            style={{ marginLeft: 18, marginRight: 18, marginTop: 18 }}
            theme={{ colors: { primary: 'blue' } }}
          /&gt;
  );
  }
  </code></pre>
  <p>Home Screen:-</p>
  <pre><code>function HomeScreen({ navigation }) {
    const [data, setData] = useState([]);
    const [name, setName] = useState('');
    const [loading, setLoading] = useState(true);
  
    const fetchData = () =&gt; {
      fetch('http://10.0.0.2/')
        .then((res) =&gt; res.json())
        .then((results) =&gt; {
          setData(results);
          setName(results.name);
          setLoading(false);
  
        })
        .catch((err) =&gt; {
          Alert.alert('something went wrong in HomeScreen_fetchData()');
        });
    };
  
    useEffect(() =&gt; {
      fetchData();
    }, []);
  
    const renderList = (item) =&gt; {
      return (
        &lt;Card
          style={styles.mycard}
          onPress={() =&gt; navigation.navigate('Profile', { item })}&gt;
          &lt;View style={styles.cardView}&gt;
            &lt;Image
              style={{ width: 60, height: 60, borderRadius: 50 / 2 }}
              source={{
                uri: item.picture,
              }}
            /&gt;
            &lt;View style={{ marginLeft: 10 }}&gt;
              &lt;Text style={styles.text}&gt;{item.name}&lt;/Text&gt;
              &lt;Text&gt;{item.position}&lt;/Text&gt;
            &lt;/View&gt;
          &lt;/View&gt;
        &lt;/Card&gt;
      );
    };
    
    return (
        &lt;CustomHeader title=&quot;Home&quot; /&gt;
        &lt;View style={{ flex: 1 }}&gt;
          
          &lt;Text&gt;Your name is {name}&lt;/Text&gt;
  
          &lt;FlatList
            data={data}
            renderItem={({ item }) =&gt; {
              return renderList(item);
            }}
            keyExtractor={(item) =&gt; item._id}
            onRefresh={() =&gt; fetchData()}
            refreshing={loading}
          /&gt;
        &lt;/View&gt;
    );
  }
  </code></pre>