From 353ef6af307f2d2011795cae330d80b0d5b20a2a Mon Sep 17 00:00:00 2001 From: Seva Podolskiy Date: Fri, 27 Sep 2024 14:20:13 -0400 Subject: [PATCH] Refactor PostItems --- src/components/NewCommentForm.tsx | 1 + src/components/PostDetails.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/components/NewCommentForm.tsx b/src/components/NewCommentForm.tsx index 3945b5282..b5f8f4a45 100644 --- a/src/components/NewCommentForm.tsx +++ b/src/components/NewCommentForm.tsx @@ -62,6 +62,7 @@ export const NewCommentForm: React.FC = ({ }; const handleClear = () => { + setBody(''); setErrorName(false); setErrorEmail(false); setErrorBody(false); diff --git a/src/components/PostDetails.tsx b/src/components/PostDetails.tsx index db7714235..1d52324d2 100644 --- a/src/components/PostDetails.tsx +++ b/src/components/PostDetails.tsx @@ -21,6 +21,9 @@ export const PostDetails: React.FC = ({ post }) => { useEffect(() => { setCommenting(false); + }, [post]); + + useEffect(() => { if (post) { setLoading(true); commentClient