Skip to content

Commit

Permalink
(#0) Input Reset시 onChange 실행
Browse files Browse the repository at this point in the history
  • Loading branch information
baegofda committed Nov 29, 2023
1 parent a7aee96 commit 8be39d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/components/Input/hooks/useInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement | HTMLTextAreaElement>;

onChange?.(event);
};

useValueChangeEffect(value, setInputValue);

Expand Down

0 comments on commit 8be39d7

Please sign in to comment.