From 8be39d7617936b394acd2ff512a87998d792c39b Mon Sep 17 00:00:00 2001 From: baegofda Date: Wed, 29 Nov 2023 17:54:37 +0900 Subject: [PATCH] =?UTF-8?q?(#0)=20Input=20Reset=EC=8B=9C=20onChange=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/components/Input/hooks/useInput.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/components/Input/hooks/useInput.ts b/src/core/components/Input/hooks/useInput.ts index 3952fe1..1ac7d76 100644 --- a/src/core/components/Input/hooks/useInput.ts +++ b/src/core/components/Input/hooks/useInput.ts @@ -19,7 +19,16 @@ export const useInput = ({ value, regCallback, onChange }: UseInputProps) => { onChange?.(e); }, [ regCallback, onChange ]); - const onResetInputValue = () => setInputValue(""); + const onResetInputValue = () => { + setInputValue(""); + + const event = { + target: { value: "" }, + currentTarget: { value: "" }, + } as unknown as React.ChangeEvent; + + onChange?.(event); + }; useValueChangeEffect(value, setInputValue);