Skip to content

Instantly share code, notes, and snippets.

@NathanHazout
Created January 31, 2021 13:58
Show Gist options
  • Save NathanHazout/fcab2820c894cff9cfb2b5bece08c37b to your computer and use it in GitHub Desktop.
Save NathanHazout/fcab2820c894cff9cfb2b5bece08c37b to your computer and use it in GitHub Desktop.
Error: Text strings must be rendered within a <Text> component.
import React from "react";
import EventList from "./EventList";
export default function App() {
return <EventList />;
}
import React from "react";
import { Text } from "react-native-web";
export default function EventCard() {
return (<Text>hi</Text>);
}
import React, { Component } from "react";
import { FlatList, Text } from "react-native";
import EventCard from "./EventCard";
class EventList extends Component {
state = {
events: [{id:"1"},{id:"2"}],
};
render() {
return (
<FlatList
data={this.state.events}
keyExtractor={(item) => item.id}
renderItem={() =><EventCard/>}
/>
);
}
}
export default EventList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment