From bc96a8de46128fbc731a45c47689bc2c24b50cfd Mon Sep 17 00:00:00 2001 From: AaronKeys Date: Sun, 21 Apr 2024 15:20:09 -0400 Subject: [PATCH] fixed the problem with error showing on start --- FU.SPA/src/components/PostForm.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FU.SPA/src/components/PostForm.jsx b/FU.SPA/src/components/PostForm.jsx index 52489ff8..8cd9314e 100644 --- a/FU.SPA/src/components/PostForm.jsx +++ b/FU.SPA/src/components/PostForm.jsx @@ -81,13 +81,13 @@ const PostForm = ({ onSubmit, submitButtonText, initialValue }) => { // Handles title state error const handleTitleChange = (e) => { - if (e.target.value < 3) { + if (e.target.value.length < 3 && e.target.value.length > 0) { setTitleError('Title must be longer than 3 characters'); setTitle(e.target.value); } else { - setTitle(e.target.value); setTitleError(''); } + setTitle(e.target.value); }; // Handles start date state error @@ -198,7 +198,7 @@ const PostForm = ({ onSubmit, submitButtonText, initialValue }) => {