Comments (5)
I have a related question. Is there an option to pass current values when the form is rendered for the first time.
Here is an example what use case I want to implement.
I'm fetching a resource from backend to edit and show a form where initialValues are populate from this resource. Then change some fields and destroy the form ( e.g. I can have two tabs and just switch to the next tab and come back later ). The form current values were persisted on componentWillUnmount to some external store ( e.g. localStorage, redux or something else ). Then come back to the form and now I want to set initialValues and currentValues.
One options is to set currentValues as initialValues, but I will lose pristine and dirty flags. Is there some option to change all current values?
from react-final-form.
Final Form manages its own state. You put state in, with initialValues
, and you get state out, with onSubmit
, and your global app state management solution (GASMS?) need not worry about the state of the form. However, if you want to, you can totally plug update your GASMS with state from Final Form.
I don't really understand your question, so I cannot be certain that I have answered it. ?
from react-final-form.
Ok, I understand you. I’ll think how applicable that approach for our use-cases. Thank you.
from react-final-form.
👍 Closing, then.
from react-final-form.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from react-final-form.
Related Issues (20)
- Form Reset When Modal Close HOT 1
- Field State Sync Issue in Strict vs Non-Strict Mode in react-18 HOT 5
- Q: should readonly fields be validated on blur?
- Error in codesandbox example HOT 2
- Documentation for defaultValue of FieldProps is not matching implementation
- Warning message in console when using the field validation for a string field. HOT 3
- Ran into "is dirty" validation issues when state was used to autofill a form's input field. HOT 1
- [Feature Request] Add new prop to specify changes to specific form fields HOT 1
- change is not a function HOT 1
- Rewrite To Typescript HOT 2
- rerenderOnEveryChange for react-final-form
- <FormSpy> components rendering earlier than in previous versions
- DestroyOnUnregister incompatible with StrictMode in React18 HOT 2
- isEqual is initialized by the first field registered instance
- useField does not rerender component, when its props change
- Submitting Images in React Final Form
- I believe defaultValue should be the DEFAULT. That means, if NO initialValue was passed in, the defaultValue would be used. If there is an initialValue, it should override the defaultValue. One work around is using an OR in initialValues and skip using defaultValue all together like so:
- Form not dirty after removing items from FieldArray using final-form-arrays
- Field-Level validation for root and nested fields
- The field errors are still there, but the form errors are gone
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-final-form.