Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 삭제 버튼 클릭 후 이름을 수정하면 index 불일치로 발생하는 버그 해결
Browse files Browse the repository at this point in the history
soi-ha committed Aug 20, 2024
1 parent 3a3d158 commit 5791da7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/src/hooks/useInput.tsx
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ const useInput = <T extends InputValue>({validateFunc, initialInputList}: UseInp
changeCanSubmit();
}, [errorMessage, errorIndexList]);

useEffect(() => {
setInputList(prev => prev.map((value, index) => ({...value, index})));
}, [inputList.length]);

const handleChange = (index: number = 0, value: string) => {
const {isValid, errorMessage: validationResultMessage} = validateFunc(value);

0 comments on commit 5791da7

Please sign in to comment.