-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
44 lines (40 loc) · 1.03 KB
/
App.tsx
File metadata and controls
44 lines (40 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React, { useEffect } from "react";
import { StyleSheet, Text, View } from "react-native";
import { IWork } from "./types";
import getRandomWorks from "./getRandomWorks";
export default function App() {
useEffect(() => {
// Use the provided endpoint
getRandomWorks()
.then((data: IWork[]) => {
// It will return the data directly on successful responses
// I've added very loose typings, so that data[0].title will autocomplete for you
console.info(data);
})
.catch((err) => {
console.warn("Network request failed", err);
});
}, []);
return (
<View style={styles.container}>
<Text style={styles.text}>
Review README.md {"\n"} Then view your console
</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
text: {
color: "black",
fontWeight: "700",
fontSize: 24,
textAlign: "center",
lineHeight: 38,
},
});