From 944b998e762a22a5517c348d0a652a892937d9cc Mon Sep 17 00:00:00 2001 From: Marshall Ku Date: Sun, 15 Dec 2024 17:36:20 +0900 Subject: [PATCH] Modify default value of name --- apps/blog/src/components/CommentForm/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/blog/src/components/CommentForm/index.tsx b/apps/blog/src/components/CommentForm/index.tsx index 6dc00bb..7c3dd80 100644 --- a/apps/blog/src/components/CommentForm/index.tsx +++ b/apps/blog/src/components/CommentForm/index.tsx @@ -21,7 +21,7 @@ interface CommentFormProps { const cx = classNames(styles, "comment-form"); function CommentForm({ slug, submit, isClientSide = false }: CommentFormProps) { - const [name, setName] = useState("익명"); + const [name, setName] = useState(generateRandomName()); const [body, setBody] = useState(""); const formRef = useRef(null); @@ -88,6 +88,9 @@ function CommentForm({ slug, submit, isClientSide = false }: CommentFormProps) { onChange={({ currentTarget: { value } }) => { setName(value); }} + onFirstFocus={() => { + setName(""); + }} >