Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select all form values in redux-form

Tags:

redux-form

I want to get all values from redux-form. I can't use formValueSelector, because I don't know fields names (I create them dynamically). One solution is to use store.getState().form[FORM_NAME].values, but I guess it's a dirty solution, isn't it? If so, is there another way?

like image 592
mqklin Avatar asked Feb 18 '17 13:02

mqklin


People also ask

How do I get values from Redux form?

One solution is to use store. getState(). form[FORM_NAME].

Should I store form data in Redux?

There is no “right” answer for this. Some users prefer to keep every single piece of data in Redux, to maintain a fully serializable and controlled version of their application at all times.

Is Redux form good?

Redux-form is a really great library for working with validations. You can simply develop a lot of validations for different situations. Hence it provides validation functions to validate all the values in your form at once. You may also provide individual value validation functions for each Field or FieldArray.


1 Answers

There is a getFormValues selector for that.
Or you could just get the values passed to onSubmit during form submission.

like image 128
Erik R. Avatar answered Sep 24 '22 07:09

Erik R.