Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

feat: reset fields with specific values #44

Merged
merged 7 commits into from
Mar 1, 2021
Merged

feat: reset fields with specific values #44

merged 7 commits into from
Mar 1, 2021

Conversation

JensDll
Copy link
Owner

@JensDll JensDll commented Feb 28, 2021

Changes

The resetFields function can now take an optional parameter, to reset the form fields to a specifc value:

const { resetFields } = useValidation({
  a: {
    $value: ""
  },
  b: {
    c: {
      $value: ""
    }
  }
})

resetFields({
  a: "some value",
  b: {
    c: "some nested value"
  }
})

Make sure to pass an object with the same structure as the useValidation input. Check out the Sandbox for examples.

@JensDll JensDll merged commit 63d7460 into master Mar 1, 2021
@JensDll JensDll deleted the 3.0.5 branch March 1, 2021 23:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant