Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

RN Error: Text strings must be rendered within a component

$
0
0

I know this question has been asked before but none of the answers helped me. I am getting this error in a file which contains this:

<View style={styles.listHolder}>            {data && (<MyList data={userData} onSendRequest={onSendRequest}></MyList>            )}</View>

Here data is returned by a grapqhl query (Apollo). The error is somewhere in the MyList component which looks like this:

type UserProps = {  data: UsersLazyQueryHookResult;  //originatorId: number;  onSendRequest: (id: number) => void;};export const MyList: React.FunctionComponent<UserProps> = ({  data,  //originatorId,  onSendRequest,}) => {  return (<View>      {data && (<FlatList          data={data.users.nodes}          horizontal={false}          scrollEnabled          renderItem={({ item }) => (<User              user={item}              onSendRequest={onSendRequest}            />          )}          keyExtractor={(item) => item.id.toString()}          ListEmptyComponent={NoFriendsContainer}        />      )}</View>  );};

In this component, the error falls somewhere on the first line of the return which says <View>

What am I missing out? Note that the brackets before MyList come automatically when I use Prettier for formatting.


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>