score:1
Accepted answer
There are multiple ways you can approach this, one would be to call your saveForm inside onSubmit function of Formik component and pass the parameter which handle to your saveForm which handles the reset event. Example
onSubmit:{(form, actions, resetForm ) => {
saveForm(form, actions);
}}
const saveForm = (form, { resetForm }) => {
//save form code
resetForm();
}
or You can directly set it to the onSubmit function like this
onSubmit:saveForm
This will directly pass all the parameter that onSubmit is recieving to your saveForm function.
Source: stackoverflow.com
Related Query
- formik form reset after form submit react js
- How to reset / empty form after submit in Formik
- How to reset the form after submit or after clicking on cancel button using formik
- How can we hold/persist the selected dropdown value after submit and reset the textarea in react hooks form
- set initial values after form submit formik react js
- Reset form input field after clicking submit on react js using useState
- React Bootstrap reset form after submit
- React Formik - Trigger validation only on form submit
- React - clearing an input value after form submit
- Formik - How to reset form after confirmation
- React formik form validation: How to initially have submit button disabled
- React Bootstrap + Formik - show errors after I click submit button
- Formik React with 2 buttons (Submit and Save) to submit form - Save button not to trigger validation
- react formik - fill form inputs with data after http request
- How to show an alert with errors found after submitting Formik form in react native
- How do I reset select elements in a React form after submission?
- Reset a React Native Formik form from outside the form
- REACT - Set initial data in Formik Form after fetching from API
- How to test function and inner statement after form submit handler in jest/enzyme react
- React - Redux Form not validating after form reset
- Redirect to URL after form submit in React
- "this" is undefined for a form after submit but not for button in react
- Redirect to website after form submit in react
- Refresh page after submit form in React
- React Clear Form Fields After Submit
- Formik Field not clearing after form submit
- how to reset the form and enable submit button after form submision (react-formio)?
- How can I reset form after submit in reactjs hooks
- Reset formik form using mutations react query
- React hook submit form after setState
More Query from same tag
- React Async Function wrapped in a UseEffect
- Unable to update state (Array of Objects) : React
- How can I make my fetch to be called only once inside a React Component?
- React-router not matching on valid route
- How to change the value in the array according to the index in react hooks
- React JS esLint error Unexpected block statement surrounding arrow body; move the returned value immediately after the =>
- getting error in if else condition in react js
- React Victory Line Chart For 0-10 minute timeframe
- ReactJs clear state after modal close
- How can i get an input value with useForm hook and then perform a POST with json-server?
- Ion-icon does not show when passed as a prop to another component
- React Animations - Slide between components
- Remove querystring from url - HashRouter
- Heroku environment variables are not visible for the react app
- Dynamically setting state object by passing it as variable name : React
- Leaflet.js How to remove the selected layer in Map when map is re rendered with Drawn Items
- How to change default error message in Yup
- changing css custom properties in javascript
- How to change this code more simply using for loop?
- React Native (View config getter callback for component `input` must be a function (received `undefined`). Make sure to start component names with)
- React HTMLtoJSX does not convert curly brackets
- How to add dropdown to react-table on click of icon
- why is my state not resetting inside of a function in setInterval and useEffect
- typescript react, dynamic props based on a certain prop value?
- I need to handle different inputs onChange methods with one handler
- I want to call parent function into function which is wraped in object
- Puppeteer Page.Screencast click on page
- Passing props to router component in react-router v4
- How to assign a custom icon to MaterialUI button's 'startIcon'?
- Execute server-side shell script on button click