Skip to content

Commit d8ff960

Browse files
authored
fix: cannot update a component/bad setState (#420)
* fix: cannot update a component/bad setState * fix: add dep useEffect in useForm * fix: add missing deps in useForm
1 parent 3b258d6 commit d8ff960

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-form/src/useForm.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ export function useForm<TData>(opts?: FormOptions<TData>): FormApi<TData> {
7575
})
7676

7777
formApi.useStore((state) => state.isSubmitting)
78-
formApi.update(opts)
78+
79+
React.useEffect(() => {
80+
formApi.update(opts)
81+
}, [formApi, opts])
7982

8083
return formApi as any
8184
}

0 commit comments

Comments
 (0)