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
- TypeError: setTodos is not a function
- React multi select value send to django rest
- How to store input values of a form in a array to print array data in table list in Reactjs
- Broken link in my reactjs hosted from netlify
- Dispatch call didn't go to the updatePost action creator but post got updated
- react-select function call on click event on the chip
- How to update a useState hook in a child component?
- Call an Async action after updating the react state
- Fetch api for post not working
- React reducer works, but once going through the web-page becomes undefined
- Firebase giving that db.collection is not a function
- How to efficiently edit an item which is deep inside the data set, displayed as react component?
- How to design complex multi component form in react redux
- how to make a double json external call in react
- React inline conditional, create multiple elements in 1 condition
- Memory usage is getting higher and higer while I am scrolling Flatlist and memory is not released when I stop scrolling (React Native)
- Error in MultiMain could not resolve directory webpack issue
- Setting Active State on mapped component
- react and express: get image from public folder
- How to refer state in link on react-router
- React Chartjs is not showing any output
- Why we use (null) while creating dropdown in react js?
- What is the purpose of next('r') in the context of an RxJS Subject
- Having issues getting a newline on my code
- React: Can we pass 2 forms from 2 different child components to a parent, and submit them with a button which is inside the parent component?
- Is it an anti-pattern to nest async/await?
- My Map Function Does Not Return Any Information?
- React Router v4 rendering component twice
- Location me in map from React Leaflet
- Need help to make [create-react-app] to use Aync - Await (transform-async-to-generator)!