PavelKlenin_lesson7#63
Open
PavelKlenin wants to merge 6 commits into
Open
Conversation
Lesson6_update
Lesson7_update
LeonEsquire
reviewed
Feb 17, 2019
| author: state.postCard.author, | ||
| }) | ||
|
|
||
| export default connect(mapStatetoProps)(PostCard); No newline at end of file |
Owner
There was a problem hiding this comment.
class PostCard extends React.Component {
componentDidMount () {
const postID = this.props.params.postID;
this.props.dispatch(fetchPostCard(postID));
}
render () {
let postCard = 'loading...';
if (this.props.post.id === +this.props.params.postID)
{
const comments = this.props.comments.map((comment, index) => {
return (
<Comment key={index} {...comment}/>
);
})
postCard = (
<div>
<Post {...this.props.post} author ={this.props.author}/>
<hr/>
<h3>Comments</h3>
<hr/>
{comments}
</div>
);
}
return postCard;
}
}
LeonEsquire
reviewed
Feb 17, 2019
| export default PostList; No newline at end of file | ||
| const mapStateToProps = (state) => ({posts: state.posts.posts,}) | ||
|
|
||
| export default connect(mapStateToProps)(PostList); No newline at end of file |
Owner
There was a problem hiding this comment.
class PostList extends React.Component {
render () {
let posts = 'Loading...';
if (this.props.fetched) {
posts = this.props.posts.map((post, index) => {
return (
<Post key={index} {...post}/>
);
});
}
return (
<div>
<h1>Blogs</h1>
{posts}
</div>
);
}
componentDidMount () {
this.props.dispatch(fetchPosts());
}
}
const mapStateToProps = (state) => ({
posts: state.posts.posts,
fetched: state.posts.fetched
})
HW lesson-7 fixed
Contributor
Author
|
Спасибо, исправил |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.