Created
January 31, 2021 13:58
-
-
Save NathanHazout/fcab2820c894cff9cfb2b5bece08c37b to your computer and use it in GitHub Desktop.
Error: Text strings must be rendered within a <Text> component.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import EventList from "./EventList"; | |
export default function App() { | |
return <EventList />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Text } from "react-native-web"; | |
export default function EventCard() { | |
return (<Text>hi</Text>); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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