Skip to content

Commit

Permalink
fix: cannot update a component/bad setState (#420)
Browse files Browse the repository at this point in the history
* fix: cannot update a component/bad setState

* fix: add dep useEffect in useForm

* fix: add missing deps in useForm
  • Loading branch information
GabrielModog authored Aug 31, 2023
1 parent 3b258d6 commit d8ff960
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/react-form/src/useForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export function useForm<TData>(opts?: FormOptions<TData>): FormApi<TData> {
})

formApi.useStore((state) => state.isSubmitting)
formApi.update(opts)

React.useEffect(() => {
formApi.update(opts)
}, [formApi, opts])

return formApi as any
}

0 comments on commit d8ff960

Please sign in to comment.