Created
August 4, 2021 13:43
-
-
Save hieptl/53a479d8b1b97ef608eb1d2833caca65 to your computer and use it in GitHub Desktop.
Posts Component - Facebook Clone
This file contains hidden or 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 useContext to get shared data. | |
import { useContext } from 'react'; | |
// import Context. | |
import Context from '../Context'; | |
// import custom components. | |
import Post from "./Post"; | |
function Posts() { | |
const { wallPosts } = useContext(Context); | |
return ( | |
<div> | |
{wallPosts.map((post) => ( | |
<Post | |
key={post.id} | |
createdBy={post.createdBy} | |
message={post.message} | |
timestamp={post.timestamp} | |
imageUrl={post.imageUrl} | |
userAvatar={post.userAvatar} | |
/> | |
))} | |
</div> | |
); | |
} | |
export default Posts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment