[RFC] Switch from redux-form to react-final-form
To pick up the discussion started in #3194 I just copy my comment from there to discuss pros and cons here.
I agree with @zahidraza that redux-form should be replaced with react-final-form. I think formik would be fine as well, but as redux-form is already used the transition to react-final-form (same principles, it's really easy to reuse lots of the code) this seems like the better choice to me. Here's why
I think the most important part ist an opinionated but kind of senseful one, already stated by @zahidraza The general consensus of the community is that you should not put your form state in Redux
As stated here: https://codeburst.io/final-form-the-road-to-the-checkered-flag-cd9b75c25fe, which refers to here: reduxjs/redux#1287 (comment)
I agree with this. A form should be mounted an unmounted with all it's data.
This issue was a result of all the forms using the same part of the state #2129 It has been solved, but in my opinion the solution is just a workaround. It works though... 😁
Also moving to react-final-form decouples the forms from redux.
Though it's not a really important change, so I totally understand if you say, that it should not be done
I second that. Especially for its Calculated Values feature.
Redux form can also bring a bunch of headaches, we sometimes have our caret jumping to the end of the input text when typing. It is not updatable as [email protected] is not working with the current version of react-admin, etc...
From what I heard from most of the react community, redux-form is the weakest framework to build form in react, it is slow and full of bug, not simple to go with. I've often seen myself criticized for using react-admin, just because of redux-form in it. It would make sense to switch to a better library now that the ecosystem is more mature.
I fully agree with all of you :+1:
OK, we're convinced, I've placed this migration in the 3.0 roadmap (see #3194). Feel free to give a hand!
Concerning the discussion in #3194
I don't think the form state needs to be mutated by dispatching any actions. All data is initially created in the component and then only altered there, or am I missing something?
Linking two inputs is quite easy in react-final-form. See here: https://github.com/final-form/react-final-form#conditional-fields for Conditional Fields or here: https://github.com/final-form/react-final-form#calculated-fields for calculated fields based on other values of the form