From 3a40bea9c468d4c76fce8da11ad7ca84c8e3be0b Mon Sep 17 00:00:00 2001 From: moonlitgrace Date: Thu, 7 Nov 2024 14:52:47 +0530 Subject: [PATCH] fix: react controlled state change --- app/_components/_admin/admin-blog-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/_components/_admin/admin-blog-form.tsx b/app/_components/_admin/admin-blog-form.tsx index dcf843d..5bedf8c 100644 --- a/app/_components/_admin/admin-blog-form.tsx +++ b/app/_components/_admin/admin-blog-form.tsx @@ -24,7 +24,7 @@ type Props = Partial<{ export default function AdminBlogForm({ id, title, tag, content, cover, draft = false }: Props) { const [state, action, isPending] = useActionState(adminBlogSubmit, undefined); - const [contentState, setContentState] = useState(content); + const [contentState, setContentState] = useState(content ?? ''); const [showCoverClearBtn, setShowCoverClearBtn] = useState(false); const inputRef = useRef(null);