-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page reload after submit #2505
Comments
I am facing the same issue. What I had to do to resolve it was, pass the
|
You can also pass <Formik
initialValues={{
email: 'hello',
password: 'world'
}}
onSubmit={(values) => {
console.log(values); // -> { email: 'hello', password: 'world' }
}}
>
{(form) => <form onSubmit={form.handleSubmit} >
...
</form>}
</Formik> |
I have realized that this problem occurs in case of nested forms. If you remove the nesting it should go away. |
@s7dhansh thank you, I removed the nesting and the Enter key now works correctly without refreshing page. |
What do you mean by "nested forms"? Because i have this exact error but i dont see a form inside a form in my code. |
I had the same issue because I was (unconsciously) unloading form component when fetch happened and showing loading spinner instead. It was enough to reorganize code not to unload form component and all state persisted with no refresh. |
馃悰 Bug report
Current Behavior
Form is automaticly refresh and reset + reload page after submit form
Expected behavior
After clicking on submit button of my form the page reloads and reset all things
My code
Your environment
The text was updated successfully, but these errors were encountered: