Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Switch from redux-form to react-final-form #3285

Closed
nik-lampe opened this issue May 29, 2019 · 5 comments
Closed

[RFC] Switch from redux-form to react-final-form #3285

nik-lampe opened this issue May 29, 2019 · 5 comments

Comments

@nik-lampe
Copy link
Contributor

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

@nik-lampe nik-lampe changed the title Suggestion - Switch from redux-form to Suggestion - Switch from redux-form to react-final-form May 29, 2019
@Balipeace
Copy link

I second that. Especially for its Calculated Values feature.

@kopax
Copy link
Contributor

kopax commented Jun 3, 2019

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 redux-form@8.0.0 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.

@djhi
Copy link
Collaborator

djhi commented Jun 3, 2019

I fully agree with all of you 👍

@fzaninotto fzaninotto changed the title Suggestion - Switch from redux-form to react-final-form [RFC] Switch from redux-form to react-final-form Jun 6, 2019
@fzaninotto
Copy link
Member

OK, we're convinced, I've placed this migration in the 3.0 roadmap (see #3194). Feel free to give a hand!

@nik-lampe
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants