-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeed.js
43 lines (35 loc) · 999 Bytes
/
Feed.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
import React, { useEffect, useState } from "react";
import './Feed.css';
import TweetBox from "./TweetBox"
import Post from "./Post";
import db from "./firebase";
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 />
{/*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}/>
))}
</div>
)
}
export default Feed