diff --git a/src/App.tsx b/src/App.tsx index 4cffbe2a0..7b7a14617 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -27,7 +27,7 @@ function getComment(postId: number): Comment[] { const posts: Post[] = postsFromServer.map(post => ({ ...post, user: getUser(post.userId), - comment: getComment(post.id), + comments: getComment(post.id), })); export const App: React.FC = () => ( diff --git a/src/components/PostInfo/PostInfo.tsx b/src/components/PostInfo/PostInfo.tsx index 0f125721b..5e27121f6 100644 --- a/src/components/PostInfo/PostInfo.tsx +++ b/src/components/PostInfo/PostInfo.tsx @@ -20,8 +20,8 @@ export const PostInfo: React.FC = ({ post }) => {

{post.body}


- {post.comment !== undefined && post.comment.length > 0 ? ( - + {post.comments !== undefined && post.comments.length > 0 ? ( + ) : ( No comments yet )} diff --git a/src/types/Post.ts b/src/types/Post.ts index 9ef255a65..ac40f4149 100644 --- a/src/types/Post.ts +++ b/src/types/Post.ts @@ -6,6 +6,6 @@ export interface Post { id: number; title: string; body: string; - comment: Comment[]; + comments: Comment[]; user: User | null; }