Add setSubmitting function
See original GitHub issueIn the documentation I did not find an example of how to control isSubmitting.
Formik has setSubmitting functionality
I need to manually specify isSubmitting = false. Because I use redux-saga and my requests are sent through the store.
<FormContext {...methods}>
<Form onSubmit={methods.handleSubmit(handleSubmit)} layout="vertical">
Here is the handle I use with formik:
const handleSubmit = values => {
onLogin({
payload: values,
onSuccess: () => {
Router.push('/');
},
onError: rej => {
setErrors(rej);
},
onFinally: () => {
setSubmitting(false);
}
});
};
There is an opportunity to get around this by writing this action to a promise. But I think this is not a very elegant solution.
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (13 by maintainers)
Top Results From Across the Web
How can I use formik's setSubmitting() method on onSubmit ...
ref 's values in react are inside a property called current . the correct way would be: formikRef.current.setSubmitting(false);.
Read more >formik.setSubmitting JavaScript and Node.js code examples
Best JavaScript code snippets using formik.setSubmitting(Showing top 15 results out of 315) · Most used formik functions · Popular in JavaScript.
Read more >Building forms with Formik in React - LogRocket Blog
Using Formik's setSubmitting. The setSubmitting function sets the isSubmitting property of the Formik's render props: setSubmitting ...
Read more >API Reference - Formik
However, if your onSubmit function is synchronous, then you need to call setSubmitting(false) on your own. validate?: (values: Values) => FormikErrors<Values> | ...
Read more >Forms in React with Formik - YouTube
This video covers how to use Formik to create and manage forms in React. We'll cover getting user input, validating it with Yup, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

hey @StKostyantin sorry for not accepting the feature request… trust me the last thing i want to do is to deny someone’s feature request while still remain the lib to be simple (I hope to keep the amount of API limited, so users can easier pick it up, obviously there will be drawbacks). it’s a tradeoff that i have to take sometimes… hope you will understand. 🙏
yea @keiya01 is our wizard for testing. 🧙