import React, { useState, useEffect } from 'react'; import { Text, View, ScrollView, Button, StyleSheet } from 'react-native'; import API from './../API.js'; let UserName = (props) => { let [profile, setProfile] = useState({}); useEffect(async () => { let p = await API.getUserProfile(props.profileid).catch(()=>{return {}}); setProfile(p); }, [props.profileid]); return ( {profile.profile && profile.profile.firstName} {profile.profile && profile.profile.lastName} ); } export default UserName; const styles = StyleSheet.create({ });