first commit in repo
This commit is contained in:
34
components/Feed.js
Normal file
34
components/Feed.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Text, View, ScrollView, Button } from 'react-native';
|
||||
import API from './../API.js';
|
||||
|
||||
|
||||
let Feed = () => {
|
||||
let [Me, setMeProfile] = useState({});
|
||||
let [Posts, setPosts] = useState([]);
|
||||
useEffect(async () => {
|
||||
let r = await API.getMe();
|
||||
setMeProfile(r);
|
||||
let posts = await API.getPosts();
|
||||
setPosts(posts)
|
||||
//console.log(posts)
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<ScrollView>
|
||||
<Text>Hello: {Me.profile && Me.profile.firstName} {Me.profile && Me.profile.lastName}</Text>
|
||||
{
|
||||
Posts.map((post, i) => {
|
||||
return (
|
||||
<Text key={i}>{post.content}</Text>
|
||||
)
|
||||
})
|
||||
}
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default Feed;
|
||||
Reference in New Issue
Block a user