From 1726a3e8eb8c4020276e591156d9eed332b5b890 Mon Sep 17 00:00:00 2001
From: nex1994
Date: Wed, 8 Jan 2025 19:18:34 +0100
Subject: [PATCH] check if post.comment !== undefined
---
src/components/CommentInfo/CommentInfo.tsx | 10 +++++-----
src/components/PostInfo/PostInfo.tsx | 3 ++-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/components/CommentInfo/CommentInfo.tsx b/src/components/CommentInfo/CommentInfo.tsx
index 979e73765..101b52b40 100644
--- a/src/components/CommentInfo/CommentInfo.tsx
+++ b/src/components/CommentInfo/CommentInfo.tsx
@@ -2,23 +2,23 @@ import React from 'react';
import { Comment } from '../../types/Comments';
type Props = {
- comment: Comment | null;
+ comment: Comment;
};
export const CommentInfo: React.FC = ({ comment }) => {
return (
-
{comment?.body}
+
{comment.body}
);
};
diff --git a/src/components/PostInfo/PostInfo.tsx b/src/components/PostInfo/PostInfo.tsx
index eabf4afd0..0f125721b 100644
--- a/src/components/PostInfo/PostInfo.tsx
+++ b/src/components/PostInfo/PostInfo.tsx
@@ -18,13 +18,14 @@ export const PostInfo: React.FC = ({ post }) => {
-
{post.body}
+
{post.comment !== undefined && post.comment.length > 0 ? (
) : (
No comments yet
)}
+ ;
);
};