Skip to content

Commit d7af692

Browse files
committed
only update model if on change is defined
1 parent dbce8b0 commit d7af692

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/hooks.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ export function useForm<T>({
5151
onSubmitError,
5252
onInit,
5353
onChange: () => {
54-
onChange?.(formRef.current);
55-
formRef.current.updateOriginalModel();
54+
if (onChange) {
55+
onChange(formRef.current);
56+
formRef.current.updateOriginalModel();
57+
}
5658
},
5759
})
5860
);

0 commit comments

Comments
 (0)