Skip to content
Discussion options

You must be logged in to vote

It's a known limitation that was partly addressed in issue #9863.

Regarding your specific use case, there are two aspects to consider:

  • Firstly, given that your example demonstrates the propagation of user input into the reset values, you can utilize the keepValues property of the reset method to retain the previously entered values:
reset(defaultValues, {
  keepValues: true
});
  • Secondly, if it's necessary to validate the user input upon form reset, you can subscribe to the isDirty state of the form. This state should reset along with the form, as you're providing new default values for the form.

Check out this codesandbox for example.

import { useEffect } from "react"
import { useForm } 

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Kadrian
Comment options

Answer selected by Kadrian
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants