'SetSubmitting is not a function
I have this Formik form that I integrated in a modal. What i try to do with it is pretty simple: assign some data from a user to another user.
Basically I have this onSubmit function that expects setSubmitting as a parameter.
const handleSubmit = ({ setSubmitting }) => {
assignAndMove(props.request);
setSubmitting(false);
props.handleClose();
};
This is how my Formik onSubmit looks:
<Formik
validationSchema={schema}
onSubmit={({ setSubmitting }) => {
console.log("args:", arguments);
handleSubmit({setSubmitting});
}}
>
and this is the onSubmit from my from:
<Form
noValidate
onSubmit={(e) => {
e.preventDefault();
handleSubmit(setSubmitting);
}}
>
The problem is that I fail to call setSubmitting(false) from my handleSubmit function.
I get this error: Formik.tsx:824 Warning: An unhandled error was caught from submitForm() TypeError: setSubmitting is not a function
Any tips are welcomed. Thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
