question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add setSubmitting function

See original GitHub issue

In 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:closed
  • Created 4 years ago
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

9reactions
bluebill1049commented, Feb 25, 2020

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. 🙏

6reactions
bluebill1049commented, Aug 18, 2020

yea @keiya01 is our wizard for testing. 🧙

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found