Skip to content

Get only changed fields in useForm #5009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
valbertVieira opened this issue Mar 17, 2025 · 0 comments
Open

Get only changed fields in useForm #5009

valbertVieira opened this issue Mar 17, 2025 · 0 comments

Comments

@valbertVieira
Copy link

valbertVieira commented Mar 17, 2025

Has some built-in utility to get only changed fields using useForm?

actually workaround

const {  handleSubmit, isFieldDirty, values } = useForm()

const onSubmit = handleSubmit( (formBody) => {
  const modifiedFields: { [key: string]: any } = {}

    for (const key in values) {
      if (isFieldDirty(key as any)) {
        modifiedFields[key] = values[key as keyof typeof values]
      }
   }
 } 

related #2753

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant