April 2020
Intermediate to advanced
716 pages
18h 55m
English
In MERN Social, we list posts in the Newsfeed and in the profile of each user. We will create a generic PostList component that will render any list of posts provided to it, which we can use in both the Newsfeed and the Profile components. The PostList component is defined as follows.
mern-social/client/post/PostList.js:
export default function PostList (props) { return ( <div style={{marginTop: '24px'}}> {props.posts.map((item, i) => { return <Post post={item} key={i} onRemove={props.removeUpdate}/> }) } </div> )}PostList.propTypes = { posts: PropTypes.array.isRequired, removeUpdate: PropTypes.func.isRequired}
The PostList component will iterate through the list of posts passed to it as props from the Newsfeed or the Profile ...
Read now
Unlock full access