Skip to content
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

Form Reset On Success #81

Open
AlexanderKaran opened this issue Feb 25, 2024 · 1 comment
Open

Form Reset On Success #81

AlexanderKaran opened this issue Feb 25, 2024 · 1 comment

Comments

@AlexanderKaran
Copy link

Once the submission is successful, I have a form that stays on the same page once the action is complete (account page in settings).

I need the form to reset (i.e. isDirty) to go back to false.

Is there a way to do this without using a useEffect? Totally happy to contribute to the docs

@chiptus
Copy link

chiptus commented Apr 30, 2024

  const [formKey, clearForm] = useReducer((state) => state + 1, 0);

  <FormComponent key={formKey} onSuccess={() => clearForm()} />
  

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

2 participants