May 2018
Intermediate to advanced
470 pages
13h 54m
English
In MERN Social, we will 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, and we can use it in both the Newsfeed and the Profile component.
mern-social/client/post/PostList.js:
class PostList extends Component { render() { return ( <div style={{marginTop: '24px'}}> {this.props.posts.map((item, i) => { return <Post post={item} key={i} onRemove={this.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, and pass the data of each ...
Read now
Unlock full access