-
Notifications
You must be signed in to change notification settings - Fork 0
/
Feed copy.js
56 lines (42 loc) · 1.17 KB
/
Feed copy.js
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
45
46
47
48
49
50
51
52
53
54
55
56
import React, { useEffect, useState } from 'react'
import "./Feed.css"
import TweetBox from './TweetBox';
import Post from "./Post"
import db from './firebase';
import FlipMove from 'react-flip-move';
function Feed() {
const [posts, setPosts] = useState([]);
useEffect(() => {
db.collection('posts').onSnapshot(snapshot =>(
setPosts(snapshot.docs.map(doc => doc.data()))
))
}, []);
return (
<div className = "feed">
{/* Header */}
<div className = "feed__header">
<h2>Home</h2>
</div>
{/* TweetBox */}
<TweetBox />
<FlipMove>
{/* Post */}
{posts.map(post => (
<Post
key = {post.text}
displayName = {post.displayName}
username = {post.username}
verified= {post.verified}
text = {post.text}
avatar = {post.avatar}
image = {post.image}/>
))}
<Post />
<Post />
<Post />
<Post />
</FlipMove>
</div>
)
}
export default Feed